Embed audio and video code in a page

Source: Internet
Author: User
A

The proper embedding of audio and video in Web pages can fully display the multimedia features of web pages, especially with the popularization of broadband network, making the network broadcast and network video become reality, the importance of web audio and video is increasingly highlighted. Specifically, the Web page audio and video embedding methods are mainly three kinds:

First, Bgsound
(i), basic grammar:
Bgsound Src=url
Description: Bgsound is used to insert background music, but only for IE browser and the browser with IE as the kernel. The URL is an audio file and its path, which can be a relative path or an absolute path.
Example: <bgsound src= "Your.mid" >


(ii), property settings:
Because bgsound embedded audio files have no controls displayed on the Web page, their properties must be set when using Bgsound.
1. Auto Play:
Syntax: Autostart=true, False
Description: This property stipulates whether the music file will play automatically after downloading.
True: Music files are played automatically after downloading;
False: The music file does not play automatically after the download is complete.
Example: <bgsound src= "Your.mid" autostart=true>
<bgsound src= "Your.mid" autostart=false>


2, loop playback:
Syntax: loop= positive integer or infinite
Description: This property sets the number of times the music file is cycled.
When the property value is a positive integer value, the music file has the same number of cycles as the positive whole value;
When the property value is infinite, the music file plays again and again, looping.
Example: <bgsound src= "Your.mid" loop=2>
<bgsound src= "Your.mid" loop=infinite>





Second, embed
(i), basic grammar:
Embed Src=url
Description: Embed can be used to insert a variety of multimedia, format can be Midi, Wav, AIFF, AU, MP3 and so on, Netscape and the new version of IE are supported. The URL is an audio or video file and its path, which can be a relative path or an absolute path.
Example: <embed src= "Your.mid" >


(ii), property settings:
1. Auto Play:
Syntax: Autostart=true, False
Description: This property stipulates whether the audio or video files will play automatically after downloading.
True: Music files are played automatically after downloading;
False: The music file does not play automatically after the download is complete.
Example: <embed src= "Your.mid" autostart=true>
<embed src= "Your.mid" autostart=false>


2, loop playback:
Syntax: loop= positive integer, True, False
Description: This property stipulates whether the audio or video files are cycled and the number of cycles.
When the property value is a positive integer value, the audio or video file has the same number of cycles as the positive integer values;
Audio or video file loop when the property value is true;
When the property value is false, the audio or video file does not loop.
Example: <embed src= "Your.mid" Autostart=true loop=2>
<embed src= "Your.mid" Autostart=true loop=true>
<embed src= "Your.mid" Autostart=true loop=false>


3, Panel display:
Syntax: Hidden=ture, no
Description: This property stipulates whether the control Panel is displayed and the default value is No.
Ture: Hidden panel;
No: Display panel.
Example: <embed src= "Your.mid" hidden=ture>
<embed src= "Your.mid" hidden=no>


4. Start time:
Syntax: Starttime=mm:ss (minutes: SEC)
Description: This property sets the time that an audio or video file should start playing. is not defined to play from the beginning of the file.
Example: <embed src= "Your.mid" starttime= "00:10" >


5, Volume Size:
Syntax: integers between volume=0-100
Description: This property sets the volume size of the audio or video file. Undefined uses the system's own settings.
Example: <embed src= "Your.mid" Volume= "ten" >


6, Container properties:
Syntax: height=# width=#
Note: The value is a positive integer or a percentage, in pixels. This property sets the height and width of the control panel.
Height: Control Panel Heights;
Width: Control Panel widths.
Example: <embed src= "Your.mid" height=200 width=200>


7. Container unit:
Grammar: Units=pixels, en
Description: This property specifies a high and wide unit of pixels or en.
Example: <embed src= "Your.mid" units= "Pixels" height=200 width=200>
<embed src= "Your.mid" units= "en" height=200 width=200>


8. Appearance setting:
Grammar: Controls=console, Smallconsole, PlayButton, Pausebutton, Stopbutton, Volumelever
Description: This property prescribes the appearance of the control Panel. The default value is console.
Console: General normal Panel;
Smallconsole: smaller panel;
PlayButton: Only show the play button;
Pausebutton: Only show pause button;
Stopbutton: Only show Stop button;
Volumelever: Only the Volume control button is displayed.
Example: <embed src= "Your.mid" controls=smallconsole>
<embed src= "Your.mid" controls=volumelever>


9, Object name:
Syntax: name=#
Description: #为对象的名称. This property names the object so that other objects can take advantage of it.
Example: <embed src= "Your.mid" name= "Sound1" >


10, the description of the text:
Syntax: title=#
Description: #为说明的文字. This property provides descriptive text for an audio or video file.
Example: <embed src= "Your.mid" title= "first song" >


11, foreground and background colors:
Syntax: Palette=color|color
Description: This property represents the foreground and background colors for an embedded audio or video file, with the first value being a foreground color, and the second value being the back, and the middle with | Separated. Color can be an RGB color (RRGGBB), or it can be a color name, or it can be transparent (transparent).
Example: <embed src= "Your.mid" palette= "Red|black" >


12, Alignment method:
Syntax: align=top, bottom, center, baseline, left, right, Texttop, middle, absmiddle, absbottom
Description: This property sets the alignment of the objects in the Control Panel and the current row.
Center: center of Control Panel;
Left: The control Panel occupies the left-hand side;
Right: Control Panel is on the right-hand side;
Top: Front of the Control Panel is aligned with the top of the highest object in the current row;
Bottom: The bottom of the control Panel is aligned with the baseline of the objects in the current row;
Baseline: The bottom of the control Panel is aligned with the baseline of the text;
Texttop: The top of the control Panel is aligned with the top of the highest text in the current line;
Middle: The center of the Control Panel is aligned with the baseline of the current line;
Absmiddle: The middle of the control Panel is aligned with the middle of the current text or object;
Absbottom: The bottom of the control Panel is aligned with the bottom of the text.
Example: <embed src= "Your.mid" align=top>
<embed src= "Your.mid" align=center>





Three, IMG dynsrc
(i) Basic grammar:
IMG Dynsrc=url
Description: IMG dynsrc can be used to insert a variety of multimedia, format can be WAV, Avi, AIFF, AU, MP3, Ra, Ram and so on. The URL is an audio or video file and its path, which can be a relative path or an absolute path.
Example:


(ii) Property settings:
1, preset Picture:
Syntax: Src=url
Description: The URL is a picture file and its path, which can be a relative path or an absolute path. The function of this property is to use a picture to occupy the display position of the video file when the video file is downloaded, the video file is downloaded, the picture is blocked, and the video file is displayed. If you specify DYNSRC as an audio file, the SRC attribute is blocked and the picture is not visible.
Example:


2. Playback events:
Syntax: Start=fileopen, mouseover
Description: This property sets the event that the file plays, and the default value is FileOpen. You can also set both. In addition, click on the play area with the mouse, and the browser will start playing the file.
FileOpen: When the file is open;
MouseOver: When the mouse moves over the playback area.
Example:




3, Container properties:
Syntax: height=# width=#
Note: The value is a positive integer or a percentage. This property sets the height and width of the control panel.
Height: level of Control Panel
Width: thickness of Control Panel
Example:


4, the description of the text:
Syntax: alt=#
Description: #为说明文字. The ALT value is a non-display description of the animated file.
Example:


5, Control display:
Syntax: Controls
Description: The playback control bar used to attach ms-windows to the video window.
Example:


6, Loop playback:
Syntax: loop= positive integer or infinite
Note: This property stipulates the number of cycles of audio or video files, the property value is-1 or infinite, audio or video files repeated playback, loop.
When the property value is a positive integer value, the audio or video file has the same number of cycles as the positive integer values;
When the property value is infinite, the audio or video files play back and forth, looping.
Example:



7, Delay Playback:
Syntax: loopdelay=#
Description: #= the number of milliseconds. This property sets the time delay for playback of an audio or video file.
Example:


8, Filler properties:
Syntax: hspace=# vspace=#
Note: The value is a positive integer, in pixels. Two properties should be applied at the same time.
Hspace: The distance from the screen to the left of the page;
Vspace: Screen from the top of the page.
Example:

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.