-
Notifications
You must be signed in to change notification settings - Fork 148
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlayFullscreen on button click #135
Comments
hey! it looks like there's a you could probably do something like $scope.$on('youtube.player.ready', function ($event, player) {
player.playVideo();
var iframe = player.getIframe()
var requestFullScreen = iframe.requestFullScreen || iframe.mozRequestFullScreen || iframe.webkitRequestFullScreen
if (requestFullScreen) {
requestFullScreen.bind(iframe)()
}
}) i haven't actually tried running that code, but it should help you head in the right direction. good luck and let me know if there's anything else i can clear up! 馃専 |
Thanks for quick reply Brandly. then I tried to put button click event and all together failed in achieving it :( as I mentioned before it works for me as a <script> tag in the moviedetails template but when I navigate and try to load other video it doesn't works. like >> Home page >> Click on poster >> click on play button >> it works >> go back click other movie poster >> click on play button it doesn't plays/in fullscreen. this is how my controller looks like. solution much appreciated. `(function () {
})();` |
Got the same error. Any solution? |
i tried reproducing the error and seeing if a if someone could fork that to produce the error, that'd be great! |
How to make this work on mobile, I mean the player goes full screen on button click? |
Hi,
Thanks for the directive and it works awesome 馃憤
And I am wondering how can change the player extension when user clicks on Play button it should auto play in fullscreen. was able to get it worked with JS with script tags in my player since I am using angular was facing few bugs with it and started looking into this extensions which works pretty neat.
the below code which i used to play full screen on button click.
appreciate if we can added it in this directive or how should I include it in my controller so that I can achieve fullscreen on play button
Reference
<script> var player, iframe; var playnow = document.querySelector.bind(document); // init player function onYouTubeIframeAPIReady(vart) { player = new YT.Player('player', { height: '200', width: '300', videoId: '123455987', //events: { // 'onReady': onPlayerReady //} }); } // when ready, wait for clicks //function onPlayerReady(event) { // var player = event.target; // iframe = playnow('#player'); // //setupListener(); //} //function setupListener() { // playnow('button').addEventListener('click', playFullscreen); //} //$("#testvid").click(function () { // $("#player").show(); // if (player) { // var fn = function(){ // playFullscreen(); // } // } //}); //function playFullscreen() { // //iframe.css("visibility", "visible"); // player.playVideo(); // var requestFullScreen = iframe.requestFullScreen || iframe.mozRequestFullScreen || iframe.webkitRequestFullScreen; // if (requestFullScreen) { // requestFullScreen.bind(iframe)(); // } //} </script>The text was updated successfully, but these errors were encountered: