Last active
April 22, 2021 16:58
-
-
Save tonycoco/72087d874b620fa06a25d7acb3732a03 to your computer and use it in GitHub Desktop.
Safari Bookmarklet for <video> AirPlay options – Copy the `bookmarket.js` snippet and paste it as the address of a bookmark in Safari. Then, while playing any <video> you can click the bookmarklet and the <video> will bring up your AirPlay options.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:if(window.WebKitPlaybackTargetAvailabilityEvent){var videos=document.getElementsByTagName("video");if(videos.length>0)for(var airplayable=videos[0],i=0;i<videos.length;i++)if(!(airplayable=videos[i]).paused){airplayable.webkitShowPlaybackTargetPicker();break}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.WebKitPlaybackTargetAvailabilityEvent) { | |
var videos = document.getElementsByTagName("video"); | |
if (videos.length > 0) { | |
var airplayable = videos[0]; | |
for (var i = 0; i < videos.length; i++) { | |
airplayable = videos[i]; | |
if (airplayable.paused) { | |
continue; | |
} | |
airplayable.webkitShowPlaybackTargetPicker(); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment