What video are you playing? Vimeo, Youtube or HTML video?
Curious how do I auto close video and return to original screen once video has finished? My js code is minimized so not able to explore the code. Thanks!
What video are you playing? Vimeo, Youtube or HTML video?
YouTube
(said content is too short so adding meaningless words here)
Then you can open ninjaVieoPlugin.mini.js, search for:
,500);_zSlider.next()
and replace it with:
,500);
Didn't seem to change anything. Once the video ends it closes the video player to original screen for a second (how I want it too), but then the youtube player opens back up to the end of the video.
Then please try another work around. Open ninjaVieoPlugin.mini.js, search for:
,500);_zSlider.next()
and replace it with:
,500);_zSlider.next();nslider.prev()
Really close. It is closing the video after it has finished which I want, but it is sliding to the next videos placeholder screen instead of returning to original screen of the video the user is watching.
I can deal with it as is, but if it isn't to much more work I would like to adjust. THANKS!
The nslider.prev() will make the slider immediately come back to the current slide.
So if you haven't changed the slider name, nslider, that is the following line in ninja-slider.js:
var nslider = new NinjaSlider(nsOptions);
Then nslider.prev() should bring the next slide back to the current slide.
I haven't changed the name and for whatever reason it isn't working. When it closes it is sliding to the next videos placeholder image instead of just closing to the current videos placeholder that was clicked.
Is there something like this we can put in?
function onPlayerStateChange(event) {
if(event.data === 0) {
// close video
}
}
Sorry my previous workaround doesn't work.
Please try another approach. Search for:
else if(a.data==0){setTimeout(function(){_zSlider.iframe.src=_zSlider.iframe.getAttribute("src");_zSlider.iframe.parentNode.parentNode.yplayer=new YT.Player(_zSlider.iframe.id,{events:{onStateChange:onYTPlayerStateChange}})},500);_zSlider.next()}}
And replace it with:
else if(a.data==0){_zSlider.next(); setTimeout(function () { nslider.prev(); nslider.toggle();}, 20);}}
I have added nslider.toggle(); in above line to stop the slider. If you don't want to stop it, remove that command. If you want to stop it for some time but not forever, you can add another setTimeout to call the nslider.toggle() again to start the slider.
It some what works now. So I have 3 slides with embedded youtube videos with a placeholder image over the top of each video slide that you have to click to play the video. When I click the first or last slide and open the youtube video and it plays and finishes it closes back to original/correct placeholder. But when I click on the second/middle slider and its youtube video finishes, it closes and slides me over to the last/third placeholder slide image instead of the placeholder image that was clicked (second/middle).
Any idea why that would be? Thanks!
How about if you increase the delay from 20 to 120 in my workaround:
else if(a.data==0){_zSlider.next(); setTimeout(function () { nslider.prev(); nslider.toggle();}, 120);}}
Kind of works. Sometimes it works, sometimes it doesn't. It just seems really glitchy. I will make do with it. Thanks for your help!
If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;
If your question is related to the Ninja Slider, click:
Ask new question: Ninja SliderOtherwise navigate to one of the following forum categories, and post your question there.
##