Modify default HTML5 video controls

回眸只為那壹抹淺笑 提交于 2019-12-01 11:12:28

问题


I have a rather unusual question for you all; it might be foolish but I am new to this area and I would really appreciate some help.

As the title suggests I was wondering if there is a way to disable a specific button from the default browser controls for the HTML5 video.

I know that each browser has its own somewhat unique looking set of controls so I don't think that I can overlay the button with CSS. If it is impossible is it maybe possible to somehow tie via Javascript the event of the video going full screen to another event?

I was looking into making the custom controls or using the pre-made players but if at all possible I would like to get away without using either.

I appreciate any help.


回答1:


You can't hide specific native controls. You can either use them or hide them via the controls attribute.

As far as using listening to fullscreen events along with other events the video API provides, longtail does extensive research on compatibilities or lack thereof within different browsers and devices.

You can make your own css controls on top of the video element and control different actions via the html5 media api demonstrated here.

For fullscreen type things, I'd recommend looking through the code here as it was written for the Vimeo HTML5 player specifically.

It's kind of a nightmare dealing with the Video API depending how much support you're trying to achieve.



来源:https://stackoverflow.com/questions/17052390/modify-default-html5-video-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!