2 Replies - 1796 Views - Last Post: 06 January 2013 - 10:50 PM

#1 richiebee  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 259
  • Joined: 27-November 08

preroll html5 video using js

Posted 15 July 2012 - 05:37 AM

I have a preroll video advert 30 seconds which plays (just using mp4 for now in chrome)

then the actual video auto plays after,

two issues for now,

1.Need the prevent preroll to be able to be skipped as the controls are showing but be able to be started. (they have to for the second video)

2.Stop the second video is looping

http://wiziwiz.com/pr3.html

<script type="text/javascript">
 
        // listener function changes src
        function myNewSrc() {
        var myVideo = document.getElementsByTagName('video')[0];
        myVideo.src="http://www.wiziwiz.com/4f59dd2fe1e60.mp4";
        myVideo.load();
        myVideo.play();
		
        }
        // add listener function to ended event -->
        function myAddListener(){
        var myVideo = document.getElementsByTagName('video')[0];
        myVideo.addEventListener('ended',myNewSrc,false);
		
        }
    </script>
</head>
<body onload="myAddListener()">
    <p>HTML5 Pre roll</p>
     <div style="background-color:#000000; width:720px; height:404px;"><video id="myvideo" controls preload="auto" width="720" height="404"
    src="http://cdn.smart-video.tv/videos/ipad/4f422ca47cead.mp4" poster="http://www.wiziwiz.com/4f59dd2fe1e60.jpg">
    </video></div>
    
    </body>


Is This A Good Question/Topic? 0
  • +

Replies To: preroll html5 video using js

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: preroll html5 video using js

Posted 15 July 2012 - 08:54 AM

Moving to javascript..
Was This Post Helpful? 0
  • +
  • -

#3 gencoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-January 13

Re: preroll html5 video using js

Posted 06 January 2013 - 10:50 PM

I have the similar problem still havent found a permanent solution but till now i managed to stop the main video at the last moment meaning when it reaches the last second it will stop/pause i did this by using timer after video source add #t=1,3:00 you can lookup more in to it in de https://developer.mo...audio_and_video hope this helps a little if more progress, this ill be posted
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1