Home >Web Front-end >HTML Tutorial >Common web player codes
The players we see on the web are nothing more than WMP/RealPlayer/Flash Player. The others are just different panels or have other controls added. Some players installed on the computer are also the integration of encoding and decoding. The core encoding and decoding technologies are the same. For example: the most popular windows media streams on the Internet (asf, wma, wmv formats), Real streams (rm, rmvb formats), and MPEG series encoding formats (MP4, MP3 formats). The following is the common web player code compiled by admin10000.com
1. Use the Embed tag to play multimedia files
Format . The file name can be in any multimedia file format. For example, "test.wma" will display a Windows Media Player on the web page (because wma is exclusive to WMP). Another example is "test.rm". Display a Real Player player on the web page. Of course, RealPlayer must be installed on your computer to display it.
In fact, the embed tag can also display Flash animation (in this case, the role of the embed tag is similar to that of using the object tag to display Flash animation), example:
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" type="application/x-oleobject" height="200" width="300">
<param name="filename" value="test.wmv" />
<param name="autostart" value="false" />
<param name="showstatusbar" value="true" />
<param name="showtracker" value="true" />
<param name="showcontrols" value="true" />
<embed filename="test.wmv" autostart="false" pluginspage="http://www.microsoft.com/windows/windowsmedia/" showcontrols="true" showstatusbar="true" showtracker="true" src="test.wmv" type="application/x-mplayer2" height="200" width="300">embed>
object>
Windows Media Player 7 及更高版本的 class ID 是:clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6
上面例子中的 class ID 是一个老的版本,但是依然可以工作,这是因为其向后兼容性。但是如果使用了老的 class ID,就无法使用增加到组件中的新特性了。
下面给出新版本的例子
<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" height="200" width="300">
<param name="url" value="test.wmv" />
<param name="autostart" value="false" />
<param name="showstatusbar" value="true" />
<param name="showtracker" value="true" />
<param name="showcontrols" value="true" />
<param name="uimode" value="full"/>
<embed filename="test.wmv" autostart="false" showcontrols="true" showstatusbar="true" showtracker="true" uimode="full" src="test.wmv" type="application/x-mplayer2" height="200" width="300">embed>
object>
3. Call Real Player to play
Can be used to play rm, ram and other format files
Playback box:
<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height =285 id=RAOCX name=rmplay width=356>
<param name=" SRC" value="Video address">
<param name="CONSOLE" value="Clip1">
<param name="CONTROLS" value=" imagewindow">
<param name="AUTOSTART " value="true">
<embed src="Video address" autostart="true" controls=" ImageWindow" console="Clip1" pluginspage="http://www.real.com" /' width="356" height="285">
embed>
object>
Control frame: can be followed closely by the play frame
<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=27 id=video1 width=356 >
<param name="_ExtentX" value ="7276">
<param name="_ExtentY" value="1058">
<param name="AUTOSTART" value="0">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="CONTROLS" value="ControlPanel">
<param name="CONSOLE" value="Clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#ffffff">
<embed type="audio/x-pn-realaudio-plugin" console ="Clip1" controls="ControlPanel" height="27" width="356" autostart="0" _extentx="7276" _extenty="1058" shuffle="0" prefetch="0" nolabels ="0" loop="0" numloop="0" center="0" maintainaspect="0" backgroundcolor="#ffffff"> ;
embed>
< ;/object>
Finally, detailed parameter descriptions of Windows Media Player and Real Player are given
Windows Media Player "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" 参数说明 | ||
---|---|---|
参数 | 默认值 | 说明 |
AudioStream | true | |
AutoSize | true | 是否自动调整播放大小 |
AutoStart | true | 是否自动播放 |
AnimationAtStart | true | 整个动画是否在下载时同时播放 |
AllowScan | true | |
AllowChangeDisplaySize | true | |
AutoRewind | false | |
Balance | false | 左右声道平衡,最左-9640,最右9640 |
BaseURL | ||
BufferingTime | 5 | 缓冲时间 |
CaptioningID | ||
ClickToPlay | true | 当用户点击播放区域时是否启动播放器 |
CursorType | false | |
CurrentPosition | true | 当前播放进度 -1 表示不变,0表示开头 单位是秒,比如10表示从第10秒处开始播放,值必须是-1.0或大于等于0 |
CurrentMarker | false | |
DefaultFrame | ||
DisplayBackColor | false | |
DisplayForeColor | 16777215 | |
DisplayMode | false | |
DisplaySize | false | 视频1-50%, 0-100%, 2-200%,3-全屏 其它的值作0处理,小数则采用四舍五入然后按前的处理 |
Enabled | true | |
EnableContextMenu | true | 是否用右键弹出菜单控制 |
EnablePositionControls | true | |
EnableFullScreenControls | false | |
EnableTracker | true | 是否允许拉动播放进度条到任意地方播放 |
Filename | URL | 指定播放文件的URL |
InvokeURLs | true | |
Language | true | |
Mute | false | 是否静音 |
PlayCount | 1 | Repeat play times, 0 means always repeat |
PreviewMode | false | |
Rate | 1 | Playback rate control, 1 is normal, decimals are allowed |
SAMILang | SAMI language | |
SAMIStyle | SAMI style | |
SAMIFileName | Subtitle ID | |
SelectionStart | true | |
SelectionEnd | true | |
SendOpenStateChangeEvents | true | |
SendWarningEvents | true | |
SendErrorEvents | true | |
SendKeyboardEvents | false | |
SendMouseClickEvents | false | |
SendMouseMoveEvents | false | |
SendPlayStateChangeEvents | true | |
ShowCaptioning | false | Whether to display subtitles, it is a piece of black, and there will be a large piece of black below. Generally, | is not displayed.
ShowControls | true | Whether to display controls, such as play, stop, pause |
ShowAudioControls | true | Whether to display the volume control |
ShowDisplay | false | Display program information, such as copyright, etc. |
ShowGotoBar | false | Whether to display the progress bar |
ShowPositionControls | true | Whether to display the forward, backward and list, if displayed, is generally gray and uncontrollable |
ShowStatusBar | false | Current playback information, showing whether it is playing, the total playback time and the current playback time |
ShowTracker | true | Whether to display the current playback tracking bar, that is, the current playback progress bar |
TransparantAtStart | false | |
VideoBorderWidth | false | If the width of the display part is smaller than the video width, the minimum is the video width, or it is increased to the specified value, and the height is automatically increased. This change only changes the size of the surrounding black frames and does not change the video size |
VideoBorderColor | false | Display the color of the black frame, which is an RGB value, for example, ffff00 is yellow |
VideoBorder3D | false | |
Volume | -200 | Volume, negative value means the decrease of the current volume, the value will automatically take the absolute value, the maximum is 0, the minimum is -9640 |
WindowlessVideo | false | If it is 0, full screen is allowed, otherwise it can only be viewed in a window |
Windows Media Player "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" Parameter Description | ||
---|---|---|
Parameter | default value | illustrate |
AutoStart | -1 | Whether to play automatically, 0 does not play automatically, -1 plays automatically |
Balance | 0 | Adjust the left and right channel balance, leftmost -9640, rightmost 9640 |
enabled | -1 | Whether the player can be controlled manually; -1 can be controlled, 0 cannot be controlled |
EnableContextMenu | -1 | Whether to enable the context menu (whether to use the right-click pop-up menu control) 0 does not display the menu, 1 displays the menu |
url | Played file address | |
PlayCount | Play count control, it is an integer, 0 means always repeat | |
rate | Playback rate control, 1 is normal, decimals are allowed, 1.0-2.0 | |
currentPosition | Control settings: current position (-1 means unchanged, 0 means the beginning, the unit is seconds, for example, 10 means starting playback from the 10th second, the value must be -1 or greater than or equal to 0) | |
currentMarker | Control settings: current tag | |
defaultFrame | Show default frame | |
invokeURLs | Script command settings: whether to call URL | |
baseURL | Script command settings: called URL | |
stretchToFit | 0 | Whether to stretch proportionally, 0 does not stretch, -1 stretches |
volume | The default sound size is 0%-100%, 50 is 50% | |
mute | Whether to mute | |
uiMode | Full | Player display mode: Full displays all; mini is the most simplified; None does not display playback controls, only displays the video window; invisible does not display all |
windowlessVideo | 0 | If it is 0, full screen can be allowed, otherwise it can only be viewed in the window; 0 window display, -1 non-window display |
fullScreen | 0 | Whether to automatically full screen when starting to play -1 means automatic full screen, 0 does not automatically full screen |
enableErrorDialogs | Whether to enable error prompt reporting | |
SAMIStyle | SAMI style | |
SAMILang | SAMI language | |
SAMIFilename | Subtitle ID |
Real Player "clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" Parameter Description | ||
---|---|---|
Parameter | default value | illustrate |
AutoStart | true | The value is True or False, specifying whether to automatically play the specified source file |
backgroundcolor | The value is any hexadecimal value starting with the symbol "#" or any predefined color, specifying the background color of the image window | |
center | A value of True or False specifies that the clip is played using the original encoding size and centered in the image window. | |
classid | "clsid: CFCDAA03-8BE4-1lcf-B84B0020AFBBCCFA:** Function: Used to specify the unique string identifier of the ActiveX control, which can identify the embedded RealPalyer player. | |
console | The value is any string, which can aggregate various RealPlayer controls on the web page so that they can be used interactively or remain independent without affecting each other | |
controls | Used to specify which controls are visible. Values can be ImageWindow, All, ControlPanel, PlavButton, PlayOnlyButton, PauseButton, StopButton, FFCtrl, RWCtrl, MuteCtrl, MuteVolume, VolumeSlider, PositionSlider, TACCtrl, HomeCtrl, InfoVolumePanel, InfoPanel, StatusBar, StatusField, PositionField. | |
height | Specifies the height of the RealPlayer element. Value is any integer value, unit: pixels. | |
id | The value is any string. Specify a name for the RealPlayer element in the tag. | |
imagestatus | true | The value is True or False. Used to specify whether to display status information in the image window. |
loop | The value is True or False. Allows you to specify whether the fragment loops infinitely. | |
maintainaspect | true | The value is True or False. Specifies whether to stretch all segments to fill the entire image window |
name | The value is any string. Specify a name for the RealPlayer element in the tag (use id in the tag) | |
nojava | The value is True or False. Avoid starting Java virtual machine | |
nolabels | True or False. You can suppress the display of title or copyright information (when realplayer5.0 or above, it is garbage...) | |
nologo | True or False. Avoid displaying | in the image window when RealPlayer starts|
numloop | Specifies the number of file slice cycles, the value is an integer value. No parameter loop | is required|
prefetch | false | The value is True or False. Specifies whether RealPlayer can obtain stream description information before playing it |
region | The value is any string. Used with SMIL. Allows you to specify that HTML should be used instead of SMIL | |
scriptcallbacks | The value is a comma-separated list. Used to specify the browser's callback monitoring (so advanced stuff!) | |
shuffle | The value is True or False. Used with multi-file ram files or SMIL files. RealPlayer can be made to randomly play files in the list | |
src | Played file address | |
type | Specify MIME type for embedded plugin | |
width | Specifies the width of the RealPlayer element. Value is any integer value |
The above is the detailed content of Common web player codes. For more information, please follow other related articles on the PHP Chinese website!