cdoggg94 Posted March 11, 2013 Share Posted March 11, 2013 I have a video embedded into a page like this : <video id="example_video_1" class="video-js vjs-default-skin" poster="images/myPoster.jpg" controls width="350" height="260" autoplay preload="auto" data-setup="{}"> <source type="video/mp4" src="Movie/BusConsulting350X260.mp4"> </video> I want it to stop at around 27 seconds, and just stay on that frame.. I have seen a few things that are sort of like this but I could not get them to work. one was this: ----------------------------------------------------------------------------------------------------------------------- You can use the Media API to listen for the ended event, once this has been fired, then set the video'scurrentTime to whatever value you want (e.g. 1 second). EDIT Try this: video.addEventListener('ended', function() { this.currentTime = 1; }, false); Where video is a handle to your video element. ----------------------------------------------------------------------------------------------------------------------- my issue with that is how to use it... any help or explanation would be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/275517-stopping-a-video-at-a-specific-time/ Share on other sites More sharing options...
Adam Posted March 11, 2013 Share Posted March 11, 2013 You would need to resolve the video variable to your actual video element, perhaps using getElementById(), but apart from that it's relatively straight-forward. You bind a callback to the 'ended' event, and when the video ends your callback is called. Assuming that snippet is correct, it looks as though the callback is bound to the video object, so you can use this to refer to your video element. Quote Link to comment https://forums.phpfreaks.com/topic/275517-stopping-a-video-at-a-specific-time/#findComment-1418017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.