jQuery 具有最简单控件的 html5 视频播放器(仅播放和暂停)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2979752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 14:40:15  来源:igfitidea点击:

html5 video player with simplest controls (only play and paus)

jqueryvideohtml

提问by matt

somehow there are really little tutorials out there for html5 video and audio playback.

不知何故,html5 视频和音频播放的教程很少。

I simply want to embed video and audio files with customized controls. However the controls should be farely simple. I only need a play-button. If clicked, play gets replaced by pause. that's all!

我只想嵌入带有自定义控件的视频和音频文件。然而,控件应该非常简单。我只需要一个播放按钮。如果单击,播放将被暂停替换。就这样!

however i even don't know how to embed/display a video without "preload controls". Somehow if i only set (without preload controls) Firefox even don't shows anything. Chrome does show a black window.

但是我什至不知道如何在没有“预加载控件”的情况下嵌入/显示视频。不知何故,如果我只设置(没有预加载控件)Firefox 甚至不显示任何内容。Chrome 确实显示了一个黑色窗口。

I would love to be able to use jquery to control the video play and pause button. Maybe you have some little start-approach for me!

我希望能够使用 jquery 来控制视频播放和暂停按钮。也许你对我有一些小入门方法!

thank you very much!

非常感谢!

采纳答案by Silvia

It's basically all stated here: HTML 5 video custom controls

基本上都在这里说明:HTML 5 video custom controls

回答by Ian Devlin

Issue 203 of .net magazinehas an article telling you exactly how to do that. The article itself doesn't seem to be online though.

.net 杂志第 203 期有一篇文章告诉您具体如何做到这一点。文章本身似乎并不在线。

That said, here's an article co-written by one of the authors (Bruce Lawson) of the above article which if you scroll down to, shows you how to create your own controls: Introduction to HTML5 video.

也就是说,这是由上述文章的一位作者 (Bruce Lawson) 共同撰写的一篇文章,如果您向下滚动到该文章,将向您展示如何创建自己的控件:HTML5 视频简介

回答by wonder

You can do:

你可以做:

$('video').trigger('play');
$('video').trigger('pause');

For more: http://wonderdesigners.com/?p=219

更多信息:http: //wonderdesigners.com/?p=219