admin管理员组文章数量:1429977
I've searched so much about HTML5 video control and I'm stuck at controlling video with javascript.There is a rule in application you should know.
There will not be any user interaction with browser at any time.
What I'm trying to achieve is
1) Open video as fullscreen and play video
2) When video is ended,close video and video will be gone from screen so html content will be seen
3) Display controls of video will not be seen at all times.
What is the easiest way to achieve such actions with javascript?
I've searched so much about HTML5 video control and I'm stuck at controlling video with javascript.There is a rule in application you should know.
There will not be any user interaction with browser at any time.
What I'm trying to achieve is
1) Open video as fullscreen and play video
2) When video is ended,close video and video will be gone from screen so html content will be seen
3) Display controls of video will not be seen at all times.
What is the easiest way to achieve such actions with javascript?
Share Improve this question asked Oct 21, 2010 at 13:51 MyraMyra 3,6563 gold badges39 silver badges47 bronze badges 1- 2) stackoverflow./questions/2954595/html5-video-callbacks – Martijn Commented Oct 21, 2010 at 13:58
3 Answers
Reset to default 2VideoJS is pure CSS based video player and it's open source.It's my only choice if I'm going to solve this problem with HTML5.
For controls of video,VideoJS has some options in the beginning.
$("video").VideoJS({
controlsbelow: false,
showControlAtStart: false
});
For Full Screen problem,I found my own solution,I wish to share it with you.
Since I know screen size,I made a panel above of all content.
.fullscreen {
width:1280px;
height:800px;
z-index:10001;
top:0;
left:0;
position:fixed;
}
Note that browser is in full screen mode,so don't mix this as normal full screen resolution of video content.
At the end of my video I'm changing visibility to hidden (display:none)
$("video").bind("ended", function () {
$("#videoContainer").removeClass("fullscreen").addClass("hidden");
});
Then both container window and video content bees full screen. Thank you all.
1)As for fullsreen:
Is there a way to make HTML5 video fullscreen?
2) maybe you could consider going with a jQuery plugin like and lightbox, maybe something like this
EDIT: and check @Mzialla´s answer.
3)As for the video player check this out:
http://videojs./
Good luck!
To hide the controls you just leave out the controls attribut on the on video element.
You can enter fullscreen for example when a user clicks a button but you can not it seem exit fullscreen when the video ends with the "ended" event.
So you can not bine exitfullscreen with "ended" event.
This seems to be made on porpuse so that you can only enter and exit fullscreen when the user does something.
Demo : http://netkoder.dk/test/test0267.html
本文标签: jqueryHow to control HTML5 video with javascriptStack Overflow
版权声明:本文标题:jquery - How to control HTML5 video with javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745488671a2660502.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论