Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #723872

    is it possible to autoclose the lightbox when video stops at the end?

    Thanks

    #725340

    Hey Guenter,

    wouldn’t be very easy as far as I know and I bet you would know the solution if it would be possible :).

    Best regards,
    Andy

    #725437

    well there is inside the iframe a class added after video play. ended-mode
    but i don’t know how to close the parent div (maybe : div.mfp-container ) if the class exists.

    i look into youtube video player api there are eventlisteners which might help

    i think it will be nice to give a unique ID to that video

    • This reply was modified 7 years, 11 months ago by Guenni007.
    #725721

    on shortcodes.js from line 900 you have :

    case "youtube": 
    	
    	var params = _self.$video.data();
    	
    	if(_self._supports_video()) params.html5 = 1;
    	
    	_self.player = new YT.Player(_self.$video.attr('id'), {
    		videoId: params.videoid,
    		height: _self.$video.attr('height'),
    		width: _self.$video.attr('width'),
    		playerVars: params,
    		events: {
    		'onReady': function(){ _self.$option_container.trigger('av-video-loaded'); },
    		'onError': function(player){ $.avia_utilities.log('YOUTUBE ERROR:', 'error', player); },
    		'onStateChange': function(event){ 
    			if (event.data === YT.PlayerState.ENDED)
    			{	
    				var command = _self.options.loop != false ? 'loop' : 'av-video-ended';
    				_self.$option_container.trigger(command); 
    			} 
    		  }
    		}
    	});

    isn’t it possible to insert here some code to close the iframe in if (event.data === YT.PlayerState.ENDED)

    #726646

    Hi!

    Unfortunately JS is not my strongest suit. I will leave the thread open just in case my teammates have an idea but i am afraid you might need to hire a freelance developer for this one :/

    Cheers!
    Yigit

    #726994

    for fancybox and other lightbox plugins there are (not so easy solutions) – but we have here on default an eventlistener implemented in enfold (aren’t we?) so in my JS suit (it is less than yours) i thought those JS Cracks here could handle it.

    #727063

    Hi,

    Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support.

    However if you just like to run a function when youtube video in a modal window starts playing we can point you to some helpful resource please check

    http://stackoverflow.com/questions/10773322/event-when-youtube-video-finished
    http://stackoverflow.com/questions/2741493/detect-when-an-html5-video-finishes

    However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Vinay

    • This reply was modified 7 years, 11 months ago by Vinay.
    #727257

    thanks vinay – meanwhile i do all know these links.
    But no link is helpful because on most of those hints the player was generated in an existing div.
    The point is to run a function outside the iframe from inside.
    Seems to be hardstuff. Can be closed

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘autoclose video lightbox ?’ is closed to new replies.