Worked around Safari bug causing captions to persist in YouTube

Worked around Safari bug causing captions to persist in Picture in
Picture mode when MediaSource buffers demonstrated in YouTube when
changing videos
This commit is contained in:
amarcu5
2017-08-24 13:59:00 +01:00
parent 0e4d709bba
commit 4faa2ecf22
3 changed files with 11 additions and 1 deletions

Binary file not shown.

View File

@@ -638,6 +638,16 @@ const resources = {
neighbourButton.title = neighbourTitle;
});
bypassBackgroundTimerThrottling();
// Workaround Safari bug; old captions persist in Picture in Picture mode when MediaSource buffers change
const video = /** @type {?HTMLVideoElement} */ (currentResource.videoElement());
document.addEventListener('spfrequest', function(){
showingCaptions = false;
removeCaptions(video);
});
document.addEventListener('spfdone', function(){
showingCaptions = video.webkitPresentationMode == 'picture-in-picture';
});
},
buttonInsertBefore: function(/** Element */ parent) {
return parent.lastChild;

View File

@@ -10,7 +10,7 @@
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<key>CFBundleVersion</key>
<string>61</string>
<string>62</string>
<key>Developer Identifier</key>
<string>BQ6Q24MF9X</string>
<key>URL</key>