Last active
March 13, 2017 14:25
-
-
Save larchanka/e5c0374c9dcdaa87c97b to your computer and use it in GitHub Desktop.
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
// Detect if AirPlay is available | |
// Mac OS Safari 9+ only | |
if (window.WebKitPlaybackTargetAvailabilityEvent) { | |
video.addEventListener('webkitplaybacktargetavailabilitychanged', function(event) { | |
switch (event.availability) { | |
case "available": | |
airPlay.style.display = 'block'; | |
break; | |
default: | |
airPlay.style.display = 'none'; | |
} | |
airPlay.addEventListener('click', function() { | |
video.webkitShowPlaybackTargetPicker(); | |
}); | |
}); | |
} else { | |
airPlay.style.display = 'none'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment