0

I want to include mp4 video in a html page that launches automatically and then loops forever.

I am using the below code which I copied from an older project. (It's probably bad and outdated)

            <p><object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="1216" height="1216">
                <param name="src" value="ISS_1k_5sec.mp4">
                <param name="loop" value="true">
                <param name="fileName" value="ISS_1k_5sec.mp4">
                <param name="animationatStart" value="true">
                <param name="transparentatStart" value="true">
                <param name="autoStart" value="true">
                <param name="showControls" value="true">
                <param name="Volume" value="-450">
                <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="ISS_1k_5sec.mp4" name="MediaPlayer1" width=1216 height=1216 autostart=1 showcontrols=1 volume=-450 loop="true"> 
        </object></p>

It launches and plays once but then stops. I can get it to play again by re-loading the page. But that's not the required functionality.

What's missing to make it loop?

FYI the page is there : http://skywatcher.space:8000/sun_2019/solar_campaign_2019.html

Gert Gottschalk
  • 1,658
  • 3
  • 25
  • 37

1 Answers1

0

Solution 1: Use HTML5 <video> tag. For autoplay: <video autoplay> For loop: <video loop>

Complete Code: <video width="320" height="240" controls loop autoplay> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video>

Visit this for details:

Solution 2: Upload video on youtube or vimeo and then embed it in your page. This will add autoplay and loop functionality in it. for youtube: <iframe style="position: absolute; top: 0; left: 0;" src="https://www.youtube.com/embed/8HSr8BjcufM?autoplay=1&controls=0&loop=1&playlist=8HSr8BjcufM&amp;showinfo=0" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> details

For Vimeo: <iframe src="https://player.vimeo.com/video/76979871?autoplay=1&loop=1&autopause=0" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> Details

Solution 3 if you don't want html5 video tag and don't want to upload on youtube or other sites. You can use html video player libraries to add controls to it. Simple <embed> or <frame> tags have no controls. to check IE compatibility Internet explorer support for video tag

foobar
  • 571
  • 1
  • 5
  • 20