How to give a preset image to a video in a Dreamweaver Web page

Source: Internet
Author: User
Tags document getelementbyid dreamweaver

When we insert a video in a Web page, do we find that when the video is not played, the window is dark and ugly, so can you preset some images before the video is played? Here are two ways to add a preset picture to a netizen.

first, get the image from the video
  
From the video, the main is to let the video jump to the desired frame, and then pause playback. See the code example in WMP and RM below:

Window Media Player:

1, first in the body to add WMP control:

<object id= "Wmvplayer" height= "width=" "" Classid= "" Clsid:6bf52a52-394a-11d3-b153-00c04f79faa6 ">

<param name= "AutoStart" value= "-1" >

<! --whether to play--> automatically

<param name= "url" value= "video. MPG ">

<! --Playback of the file address-->

</object>

2, second in the head to add JS code:

<script>

var obj,obj1;

function Stopwmvplayer ()

{

if (document. getElementById ("Wmvplayer"). Controls. Currentposition>=1. 1)//If the current position is over 1. 1, stop playing and clear the execution of the Stopwmvplayer function, otherwise continue to run the Stopwmvplayer function.

{

Document getElementById ("Wmvplayer"). Controls. Pause ();

Window Cleartimeout (obj);

}

Else

{

Obj=window. SetTimeout ("Stopwmvplayer ()", 10);

}

}

3. Add the OnLoad event to the body again:

<body onload= "document. getElementById ("Wmvplayer"). Controls. Currentposition=1;stopwmvplayer (); ">
RealOne:

1, first in the body to add RM control:

<object classid= "CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" name= "Rmplayer" width= "The Height=" Rmplayer ">

<param name= "AUTOSTART" value= "-1" >

<! --whether to play--> automatically

<param name= "SRC" value= "flower. RM ">

<! --Playback of the file address-->

<param name= "CONTROLS" value= "Imagewindow,controlpanel,statusbar" >

<! --Specify which controls are visible-->

</object>

2, second in the head to add JS code:

function Stoprmplayer ()

{

if (document. getElementById ("Rmplayer"). GetPosition () >=1100)//If the current position is more than 1100, stop playing and clear the execution of the Stoprmplayer function;

{

Document getElementById ("Rmplayer"). Dopause ();

Window Cleartimeout (OBJ1);

}

Else

{

Obj1=window. SetTimeout ("Stoprmplayer ()", 10);

}

}

3. Add the OnLoad event to the body again:

<body onload= "document. getElementById (' Rmplayer '). SetPosition (2500); Stoprmplayer (); ">


second, obtain the image from the outside
  
The main thing is to get an image from the video, so how do we do it if we need to get a picture from the outside and then show it to the window?

Window Media Plyaer:

1, first in the body to add WMP control:

<object id= "Wmvplayer" height= "width=" "" Classid= "" Clsid:6bf52a52-394a-11d3-b153-00c04f79faa6 ">

<param name= "AutoStart" value= "-1" >

<! --whether to play--> automatically

<param name= "Playcount" value= "999" >

<! -Control playback Times-->

<param name= "url" value= "movie-pic. GIF ">

<! --Playback of the file address-->

</object>

2, second in the head to add JS code:

<script>

Var obj;

function Wmvplayer ()

{

if (document. getElementById ("Wmvplayer"). playstate== "1" | | Document getElementById ("Wmvplayer"). playstate== "2") &&document. getElementById ("Wmvplayer"). Url. IndexOf ("Movie-pic.") GIF ") >0//////////When the video file is an image file, and the playback status is paused or stopped, the video file starts playing

{

Document getElementById ("Wmvplayer"). Url= "video. MPG ";

Window Cleartimeout (obj);

}

Obj=window. SetTimeout ("Wmvplayer ()", 10);

}

</script>

3. Add the OnLoad event to the body again:

<body onload= "Wmvplayer ();" >

RealOne:

1, first in the body to add RM control:

<object classid= "CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" name= "Rmplayer" width= "height=" "The Player" >

<param name= "AUTOSTART" value= "-1" >

<! --whether to play--> automatically

<param name= "SRC" value= "movie-pic. GIF ">

<! --Play file address-->

<param name= "CONTROLS" value= "Imagewindow,controlpanel,statusbar" >

<! --Specify which controls are visible-->

<param name= "LOOP" value= "true" >

<! --Loop playback-->

</object>

2, second in the head to add JS code:

<script>

var obj;

function Rmplayer ()

{

if (document. getElementById ("Rmplayer"). Getplaystate () = = "4" | | Document getElementById ("Rmplayer"). Getplaystate () = = "0") &&document. getElementById ("Rmplayer"). GetSource (). IndexOf ("Movie-pic.") GIF ") >0//////////When the video file is an image file, and the playback status is paused or stopped, the video file starts playing

{

Document getElementById ("Rmplayer"). SetSource ("Flower.") RM ");

Window Cleartimeout (obj);

}

Obj=window. SetTimeout ("Rmplayer ()", 10);

}

</script>

3. Add the OnLoad event to the body again:

<body onload= "Rmplayer ();" >

In fact, window Media player and RealOne functions in the implementation of the principle is basically the same, but some implementation of the method of the statement is different, I hope everyone in the use of attention, on the two players of the details of the other statements here is no longer a waste of breath, You can search through the Internet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.