Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send notification when video play fails #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

scott967
Copy link

@scott967 scott967 commented Jan 5, 2025

PR to provide mechanism to alert addons via xbmc.Monitor.onNotification() when addon invokes plugin via PlayMedia() and Youtube is unable to play the video (ex. no streams found)

Add a new notification event "PLAYBACK_FAILED"
Add new calls to method send_notification in yt_play.py when plugin attempts to start play of video but youtube is unable to handle for any reason.

MoojMidge and others added 3 commits January 4, 2025 12:22
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
Copy link
Owner

@MoojMidge MoojMidge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would suggest just adding the notification once in yt_play.process, rather than in multiple places in yt_play._play_stream:

https://github.com/MoojMidge/plugin.video.youtube/blob/master/resources/lib/youtube_plugin/youtube/helper/yt_play.py#L355-L362

        media_item = _play_stream(provider, context)
        if media_item:
            if position and items:
                ui.set_property(PLAYLIST_PATH,
                                items[position - 1]['file'])
                ui.set_property(PLAYLIST_POSITION, str(position))
        else:
            ui.clear_property(BUSY_FLAG)
            context.send_notification(PLAYBACK_FAILED, {'video_id': video_id})

But looking at it from a higher level, if the intent is to close a dialog and re-open it once playback has completed, wouldn't a better way of doing this be to only close the dialog if the PLAYBACK_STARTED notification is received?

@@ -63,6 +63,7 @@
PLAYBACK_STOPPED = 'playback_stopped'
REFRESH_CONTAINER = 'refresh_container'
RELOAD_ACCESS_MANAGER = 'reload_access_manager'
PLAYBACK_FAILED = 'playback_failed'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you keep this group of events in alphabetical order? And the __all__ tuple too.

@MoojMidge MoojMidge force-pushed the master branch 5 times, most recently from 647f603 to 6092bce Compare January 10, 2025 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants