YePpHa / YouTubeCenter

YouTube Center is a userscript designed to expand the functionality of YouTube. It includes the ability to download the video you're watching, auto selecting your preferred video quality and much more.
MIT License
2.89k stars 520 forks source link

Live stream are not loaded properly with HTML5 player. #1201

Closed ireun closed 9 years ago

ireun commented 9 years ago

Hello again, I've just found another bug. ;/

This one is kinda weird, sometimes it's occurring, sometimes it's not. I haven't found a way to reproduce it, bu i think it's related to HTML5, on the flash version it happened, but after sew page refreshes it vanished. Look at the screenshot.Comments are also broken with that..

In the console it's repeating itself 8 times with [ActionPanel] Loading... and of course - newest DEV build..

4ydk9t

YePpHa commented 9 years ago

It could be related to SPF, but I'm not sure. I will try to look into this.

ireun commented 9 years ago

Well, i don't think it is, i were getting this with and without SPF enabled.

YePpHa commented 9 years ago

@ireun could you send me the content of your console as it will most likely help a lot as I can compare it with my own.

ireun commented 9 years ago

Console log:

Domain registered www.youtube.com.
YouTubeCenter.js:1955 [External] Setting player configruation.
YouTubeCenter.js:1955 [Player modifyConfig] => watch
YouTubeCenter.js:1955 [Player:setPlayerType] Requesting player type change to html5
YouTubeCenter.js:1955 [Player:setPlayerType] Setting player type from null to html5
YouTubeCenter.js:1955 [Player Type] HTML5
YouTubeCenter.js:1955 [Player Ratio] Player ratio set to 1.7777777777777777
YouTubeCenter.js:1955 Chaning csi_page_type from watch,watch7ad to watch, watch7
YouTubeCenter.js:1955 Keeping the aspect
YouTubeCenter.js:1955 [Playlist] Disabled
YouTubeCenter.js:1955 [HTML5 Player] Setting player theme to dark
YouTubeCenter.js:1955 [HTML5 Player] Setting player progress color to red
watch?v=o4knYNwQN8I:266 Uncaught TypeError: Cannot set property 'innerHTML' of null
YouTubeCenter.js:1955 [SPF] ready null
YouTubeCenter.js:1955 [PageReadinessListener] At event => headerInitialized watch
YouTubeCenter.js:1955 [PageReadinessListener] At event => bodyInitialized watch
YouTubeCenter.js:1955 Adding player shortcuts to document
YouTubeCenter.js:1955 [PageReadinessListener] At event => bodyInteractive watch
YouTubeCenter.js:1955 [Property Wrapper] Wrapping the function undefined into a function wrapper.
YouTubeCenter.js:1955 [Property Wrapper] Wrapping `create` function in a wrapper.
YouTubeCenter.js:1955 [Thumbnail] Setup has begun...
YouTubeCenter.js:1955 [Storage] Saving Settings
YouTubeCenter.js:1955 [Worker] Addiong new job (UChuLeaTGRcfzo0UjL-2qSbQ)
YouTubeCenter.js:1955 [Worker] Executing new job (UChuLeaTGRcfzo0UjL-2qSbQ)
YouTubeCenter.js:1955 [ActionPanel] Loading...
YouTubeCenter.js:1955 [Player modifyConfig] => watch
YouTubeCenter.js:1955 [Player:setPlayerType] Requesting player type change to html5
YouTubeCenter.js:1955 [Player:setPlayerType] Setting player type from null to html5
YouTubeCenter.js:1955 [Player Type] HTML5
YouTubeCenter.js:1955 [Player Ratio] Player ratio set to 1.7777777777777777
YouTubeCenter.js:1955 Chaning csi_page_type from watch, watch7_html5 to watch, watch7
YouTubeCenter.js:1955 Keeping the aspect
YouTubeCenter.js:1955 [Playlist] Disabled
YouTubeCenter.js:1955 [HTML5 Player] Setting player theme to dark
YouTubeCenter.js:1955 [HTML5 Player] Setting player progress color to red
YouTubeCenter.js:1955 [Player modifyConfig] => watch
YouTubeCenter.js:1955 [Player:setPlayerType] Requesting player type change to html5
YouTubeCenter.js:1955 [Player:setPlayerType] Setting player type from null to html5
YouTubeCenter.js:1955 [Player Type] HTML5
YouTubeCenter.js:1955 [Player Ratio] Player ratio set to 1.7777777777777777
YouTubeCenter.js:1955 Chaning csi_page_type from watch,watch7ad to watch, watch7
YouTubeCenter.js:1955 Keeping the aspect
YouTubeCenter.js:1955 [Playlist] Disabled
YouTubeCenter.js:1955 [HTML5 Player] Setting player theme to dark
YouTubeCenter.js:1955 [HTML5 Player] Setting player progress color to red
YouTubeCenter.js:1955 Checking for updates in -0.01080138888888889 hours...
YouTubeCenter.js:1955 Checking for updates now...
YouTubeCenter.js:1955 [Update] This is a dev build.
YouTubeCenter.js:1955 Checking for updates...
YouTubeCenter.js:1955 [Title Listener] "" => "Target Maui Pro 2014 Day 5b English"
YouTubeCenter.js:1955 [Tab Events] Sending new settings to other open tabs.
YouTubeCenter.js:1955 [PageReadinessListener] At event => bodyComplete watch
YouTubeCenter.js:1955 [Guide] Configurating the state updater!
YouTubeCenter.js:1955 [PageReadinessListener] Stopping interval
YouTubeCenter.js:1955 Got Update Response
YouTubeCenter.js:1955 [Update] Current dev build #433. Your build number #433
YouTubeCenter.js:1955 No new updates available
YouTubeCenter.js:1955 [Worker] Job completed (UChuLeaTGRcfzo0UjL-2qSbQ)
base.js:3 Uncaught TypeError: Cannot read property 'closure_uid_124681961' of null
YouTubeCenter.js:1955 [ActionPanel] Loading...
 Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5)
YouTubeCenter.js:1955 [Storage] Saving Settings
YouTubeCenter.js:1955 [ActionPanel] Loading...
YouTubeCenter.js:1955 [Tab Events] Sending new settings to other open tabs.
8YouTubeCenter.js:1955 [ActionPanel] Loading...
YouTubeCenter.js:1955 [Storage] Saving Settings
YouTubeCenter.js:1955 [Tab Events] Sending new settings to other open tabs.
html5player.js:88 'KeyboardEvent.keyLocation' is deprecated. Please use 'KeyboardEvent.location' instead.
2YouTubeCenter.js:11209 Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
YouTubeCenter.js:1955 [Storage] Saving Settings
YouTubeCenter.js:1955 [Tab Events] Sending new settings to other open tabs.

And debug log: https://gist.github.com/ireun/594510e8fc31d6cba86c (Click on raw)

YePpHa commented 9 years ago

Okay, the issue is that YouTube doesn't load the HTML5 player where YouTube Center blocks the flash player. Therefore, the player isn't initialized. If you for instance write: ytplayer.load() in the console it will load the HTML5 player normally. However, it's unlikely that HTML5 supports live stream at the moment. ss 2014-11-26 at 09 50 22

The solution for this problem is to check if the video is a live stream and if it is then don't disable the flash player.

Yonezpt commented 9 years ago

This is actually the result of something they (Youtube devs) overlooked in their code because HTML5 is fully capable of live streaming in Chrome already and I confirmed this by forcing the html5 player to load instead of the flash player:

ss

HTML5 player working correctly with the same live stream as the one presented in the issue, no problem whatsoever, problem is youtube falls back to flash player when trying to play streams on its own. Might be because a stream takes more time to start than a file which results in the flash player fallback observed behaviour, or something else.

Nevertheless, it was causing an annoying conflict, just as you found, because the script couldn't tell if the player changed to the flash player when it was trying to force (or assuming) the html5 player.

Hopefully Youtube will fix this eventually and this problem will not happen again.

YePpHa commented 9 years ago

Yeah, anyway in the next dev version I'm forcing the flash player on live stream videos and on demand videos. This will hopefully keep 'fix' this bug until YouTube fully supports live stream in HTML5.