473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to add custom seekbar in html5 video

i am working on webapp. In this webapp i want add a seek bar, volume, current time/total time,play/pause, and a timer (time should start when the video is playing and should pause, video is paused) in this webapp i just want to calculate the total number to sec. video is played by user. thank you in advance.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.    <div style="text-align:center">
  4.       <div id="video_player_box">
  5.          <video id="my_video" width="550" height="300" onclick="playPause(this,'my_video')">
  6.           <source src="http://media.w3.org/2010/05/sintel/trailer.mp4">
  7.         </video>
  8.         <div id="video_controls_bar">
  9.           <button id="playpausebtn" onclick="playPause(this,'my_video')">Play</button>
  10.         </div>
  11.       </div>
  12.     </div>
  13.     <p id="demo"></p>
  14.     <form id="watch">
  15.       <p> TIME: <input type="text" id="txt" readonly></p>
  16.       <p>COST: <input type="text" id="cost" readonly></p>
  17.       As 0.9rs/sec
  18.     </form>   
  19.  
  20.     <script>
  21.       var str = "Hello World!";
  22.       var result;
  23.       var c = 0;
  24.       var co = 0;
  25.       var t;
  26.       var timer_is_on = 0;
  27.  
  28.       function playPause(btn, vid) {
  29.         var vid = document.getElementById(vid);
  30.         if (vid.paused) {
  31.           vid.play();
  32.           btn.innerHTML = "Pause";
  33.           result = str.fontcolor("green");
  34.           document.getElementById("demo").innerHTML = result;
  35.           if (!timer_is_on) {
  36.             timer_is_on = 1;
  37.             timedCount();
  38.           }
  39.         } else {
  40.           result = str.fontcolor("red");
  41.           document.getElementById("demo").innerHTML = result;
  42.           vid.pause();
  43.           btn.innerHTML = "Play";
  44.           clearTimeout(t);
  45.           timer_is_on = 0;
  46.           myVideo.pause();    
  47.         }
  48.       }
  49.  
  50.       function timedCount() {
  51.         document.getElementById('txt').value = c;
  52.         document.getElementById('cost').value = co;
  53.         c = c + 1;
  54.         co = c * 0.9;
  55.         t = setTimeout("timedCount()", 1000);
  56.         if (vid.ended) {
  57.           clearTimeout(t);
  58.           timer_is_on = 0;
  59.         }
  60.       }
  61.     </script>
  62.  
  63. </body>
  64. </html>
  65.  
Apr 9 '16 #1
0 1394

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dmal | last post by:
I wrote a script that allows me to start a video when an image is clicked. It works fine for html5 video but not embedded video (VLC+Webm). How do i make my script recognize the embedded video? ...
4
by: Ross09 | last post by:
I have an issue with the categories list nav of my website. It is clickable on IE but it doesnt work on all other browsers. This is the HTML code: <!DOCTYPE html> <!--> <html lang="be-nl"...
0
by: Mudassir | last post by:
There is a few different ways to show video on web page. Most popular are Windows Media Player, Quick Time, Adobe Flash or Silverlight. If you want to find out how to show video with Windows Media...
3
lightwalker19
by: lightwalker19 | last post by:
I need to find a solution to convert any mp4, avi, mpg etc to .webm.. i searched online and found a tool called ffmpeg, but i dont know if google will detect it like malware, and i dont know how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.