Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Share a good html video player compatible with mainstream browsers

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "sharing a good html video player compatible with mainstream browsers". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "share a good html video player compatible with mainstream browsers".

The code is as follows:

Visual observation should be compatible with a large number of situations.

However, we cannot prevent the video format uploaded by the user, nor can we influence the type of browser the user uses, and the user will only upload one video format, but the format of the video supported by each browser is not the same (evil browser. Based on this idea, it would be nice to have a plug-in that is compatible with all video formats in all browsers and has a beautiful and controllable appearance. Ideal is beautiful, reality is bony. However, after a long time of google, a js plug-in http://html5media.googlecode.com/svn/trunk/src/html5media.min.js that can make mainstream browsers compatible with vedio tags has been found.

Playing videos on web can also be played inline in two ways (with the img tag, it's strange that only ie supports this mode and generally does not enable it) and the use of an assistant. So we can use some helpers to play video files that are not supported above (for example: quicktime)

The video playback code combining the above two points is as follows:

The code is as follows:

Function showVideo (OBH, h, t) {/ / t file format

Var _ html =''

If ($.inArray (t, ['ogg',' mp4', 'webm']) > = 0) {/ / html5 surport

Var _ doc=document.getElementsByTagName ('head') [0]

Var script=document.createElement ('script')

Script.setAttribute ('type','text/javascript')

Script.setAttribute ('src',' http://html5media.googlecode.com/svn/trunk/src/html5media.min.js');

_ doc.appendChild (script)

Script.onload=script.onreadystatechange=function () {

If (! this.readyState | | this.readyState=='loaded' | | this.readyState=='complete') {

_ html =''

_ html + =''

$(o) .css ({"width": wishful thinking, 'height':h+'px',' cursor':'default'})

$(o) .html (_ html)

}

Script.onload=script.onreadystatechange=null

}

} else {/ / other like 3gp

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

_ html + =''

$(o) .css ({"width": wishful thinking, 'height':h+'px',' cursor':'default'})

$(o) .html (_ html)

}

}

Thank you for reading, the above is the content of "sharing a good html video player compatible with mainstream browsers". After the study of this article, I believe you have a deeper understanding of the problem of sharing a good html video player compatible with mainstream browsers. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report