In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "html5 how to achieve a custom player", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "html5 how to achieve a custom player" this article.
The code is as follows:
Play
Css style
Body {text-align:center;} header, section, footer, side, navigation, article, hgroup {display:block;} # skin {width:700px;margin:10px automatic; inner margin: 5px; background: red; border: 4px pure black; border-radius:20px;} nav {margin:5px0px;} # buttons {float:left; width: 70px; height: 22px;} # defaultBar {position:relative; floats to the left; width: 600px; height: 14 pixels Inner margin: 4px; frame: 1px pure black; background: yellow;} / * progressBar inside defaultBar * / # progressBar {position: absolute; width: 0px * javascript control change * / height:14px;/* and defaultBar height same * / background:blue;}
Javascript code
The function doFisrt () {barSize=600;// is careful not to use px units and do not use var, which is a variable variable myMovie=document.getElementById ('myMovie'); playButton=document.getElementById (' playButton'); bar=document.getElementById ('defaultBar'); progressBar=document.getElementById (' progressBar'); playButton.addEventListener ('click',playOrPause,false); / / the third argument is always false, registering the event handler for the bubbling phase. Bar.addEventListener ('click',clickedBar,false);} / / controls the movie playback and stop function playOrPause () {if (! MyMovie.pausedbread! MyMovie.ended) {myMovie.pause (); playButton [XSS _ clean] = 'play'; window.clearInterval (updatedBar); playButton [XSS _ clean] = 'pause'; UpdatedBar=setInterval (update 500);}} / / controls the dynamic display function of the progress bar update () {if (! MyMovie.ended) {varsize=parseInt (myMovie.currentTime*barSize/myMovie.duration); progressBar.style.width=size+'px';} else {progressBar.style.width='0px'; playButton [XSS _ clean] = 'play'; window.clearInterval (updatedBar);}} / / Click the progress bar control method function clickedBar (e) {if (! MyMovie.pausedbread! MyMovie.ended) {varmouseX=e.pageX-bar.offsetLeft;varnewtime=mouseX*myMovie.duration/barSize;// new start time myMovie.currentTime=newtime;progressBar.style.width=mouseX+' window.clearInterval (updatedBar);}} window.addEventListener ('load', doFisrt,FALSE). This is all the content of the article "how to implement a custom player in html5". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.