JSP player code, go down slowly to study it ...
Originated from: http://www.knowsky.com/344719.html
The players we see on the Web page are no more than Wmp/realone/macromedia Flash player, other than the panel is different, or add other controls, for the computer installed some of the players are encoding and decoder integration, The core coding and decoding techniques are the same. For example, the most popular Windows Media stream (asf,wma,wmv format ...) on the network, real Stream (RM,RMVB ...), and the MPEG Series encoding format (Mp4/mp3 format ...)
Windows Media Video, a streaming media format introduced by Microsoft, is an extension of the "Same Gate" ASF (Advanced stream format) format upgrade. In the same video quality, WMV format is very small, so it is suitable for playback and transmission online. Windows Media Player9 is compatible with all formats of WMV, the official encoder is Windows Media Encoder, but if you want to transform high-quality wmv files, then you must have a large memory to process the data ...
Inadvertently found that the Castpost player can define its own size, for the WMV format of online playback can be said to be fast enough, and then a great effort to put some of the highlights of the video and some of the classic MTV conversion WMV format to put up, although it can not download now, but as long as the number of connections is not too much, It's still a smooth ^_^.
WMP added an ActiveX decoder control, not only to play music, but also to put Flash and other video files
<object align=middle classid= "Clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" Class=object Id=MediaPlayer Height=196>
<param Name=showstatusbar value=0>
<param name=filename value= "http://202.116.*.*/video/story/chinese/hynh/b.wmv" >
<embed type=application/x-oleobject codebase= "Http://activex.microsoft.com/activex/con ... n/nsmp2inf.cab# version=5,1,52,701 ">
</embed>
</object>
Want to use WMP continuous playback Please refer to the ASX meta File Usage explanation: Use ASX playlist
The above player is an old-fashioned one, version 6.4. New players appear after MediaPlayer9.0, which means that only 9.0 or more 9.0 of the players can be used properly.
Here's a new player code that's a lot simpler than it used to be:
<object id= "Player" height= "width=" classid= "Clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" >
<param name= "AutoStart" value= "-1" >
<!--whether to play--> automatically
<param name= "Balance" value= "0" >
<!--adjust the left and right channel balance,--> with the old player code above
<param name= "Enabled" value= "-1" >
<!--player can be artificially controlled-->
<param name= "Enablecontextmenu" value= "-1" >
<!--whether context menus are enabled-->
<param name= "url" value= "/blog/1.wma" >
<!--playback file address-->
<param name= "Playcount" value= "1" >
<!--playback times control, for integer-->
<param name= "Rate" value= "1" >
<!--playback rate control, 1 is normal, allow decimal,1.0-2.0-->
<param name= "currentposition" value= "0" >
<!--control settings: Current position-->
<param name= "Currentmarker" value= "0" >
<!--control settings: Current Tag-->
<param name= "Defaultframe" value= "" >
<!--display default frame-->
<param name= "Invokeurls" value= "0" >
<!--script command settings: whether to invoke url-->
<param name= "BaseURL" value= "" >
<!--script command settings: called url-->
<param name= "Stretchtofit" value= "0" >
<!--whether to extend--> proportionally
<param name= "Volume" value= "M" >
<!--default sound size 0%-100%,50 is 50%-->
<param name= "Mute" value= "0" >
<!--Mute-->
<param name= "Uimode" value= "Mini" >
<!--player display mode: full display all; Mini simplifies; None does not display playback control, only the video window is displayed; Invisible all do not show-->
<param name= "Windowlessvideo" value= "0" >
<!--if 0 allows full-screen, you can view--> in a window only
<param name= "fullscreen" value= "0" >
<!--start playing automatically full-screen-->
<param name= "Enableerrordialogs" value= "-1" >
<!--whether to enable error notification reporting-->
<param name= "Samistyle" value>
<!--Sami style-->
<param name= "Samilang" value>
<!--Sami language-->
<param name= "Samifilename" value>
<!--subtitles id-->
</object>
--------------------------------------------------------------------------------
RealOne Player Code:
<object id= "vid" classid= "CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width=427 height=300>
<param name= "_extentx" value= "11298" >
<param name= "_extenty" value= "7938" >
<param name= "AUTOSTART" value= "-1" >
<param name= "SHUFFLE" value= "0" >
<param name= "PREFETCH" value= "0" >
<param name= "Nolabels" value= "-1" >
<param name= "SRC" value= "RTSP://211.89.225.1/ENCODER/CNR3";>
<param name= "CONTROLS" value= "Imagewindow" >
<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= "#000000" >
</object> <object id= "Vid2" classid= "CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width=427 height=30>
<param name= "_extentx" value= "11298" >
<param name= "_extenty" value= "794" >
<param name= "AUTOSTART" value= "-1" >
<param name= "SHUFFLE" value= "0" >
<param name= "PREFETCH" value= "0" >
<param name= "Nolabels" value= "-1" >
<param name= "SRC" value= "RTSP://211.89.225.1/ENCODER/CNR3";>
<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= "#000000" >
</object>
--------------------------------------------------------------------------------
Look at a lot of very complex appearance, in fact, is more than some player parameters, you can not ...
Real Player web player parameter meaning
Parameters: Autostart Property: True or false: Specifies whether the specified source file is automatically played
Parameters: BackgroundColor Property: Any 16-value or any predefined color effect that begins with the symbol "#": Specifies the background color of the image window
Parameters: Center Property: TRUE or false: Specifies that the fragment plays with the initial encoding size and is in the center of the image window.
Parameters: ClassID Property: "clsid:cfcdaa03-8be4-1lcf-b84b0020afbbccfa:** function: Specifies the unique string identifier of an ActiveX control, which can be recognized as an embedded Realpalyer player."
Parameters: Console Property: Any string action: You can aggregate various RealPlayer controls on a Web page so that they can be used interactively or remain independent, and do not affect each other
Parameters: Controls Properties: Imagewindow,all,controlpanel,plavbutton,playonlybutton, Pausebutton,stopbutton,ffctrl,rwctrl, Mutectrl,mutevolume,volumeslider,positionslider,tacctrl,homectrl,infovolumepanel,infopanel,statusbar, Statusfield,positionfield function: Allows you to specify which controls are visible.
Parameters: Height Property: Any integer value function: Specifies the height of the RealPlayer element, in pixels
Parameters: id attribute: Any string action: Specifies a name for the RealPlayer element in the label.
Parameters: Imagestatus Property: True or false: Specifies whether state information is displayed in the Image window, and the default value is True
Parameters: Loop Property: True or False: Allows you to specify whether the fragment loop is infinite
Parameters: Maintainaspect Property: True or false: The default RealPlayer stretches all pieces to fill the entire image window.
Parameters: Name property: Any string action: Specify a name for the RealPlayer element in the label (use ID in the label)
Parameters: Nojava Property: True or false: Avoid starting Java virtual machines
Parameters: Nolabels Property: True or false: You can suppress the display of title or copyright information (realplayer5.0 above, it is garbage ...)
Parameters: Nologo Property: True or false: avoid displaying in the image window when RealPlayer is started
Parameters: Numloop Property: Any integer value function: Allows you to specify the number of times the file slice loop, do not need parameter loop
Parameters: Prefetch Property: True or false: Specifies whether RealPlayer can obtain flow description information before playback, the default value is False
Parameters: Region Property: Any string action: Used with SMIL. Allows you to specify the use of HTML instead of SMIL
Parameters: Scriptcallbacks Properties: comma-separated list function: Specify browser callback monitoring (good high-level dongdong). )
Parameters: Shuffle Property: True or false: Used with multiple file slices of RAM or smil files. Allows RealPlayer to randomly play the files in the list
Parameters: Src attribute: Any valid relative or complete URL action: Specifies the address of the file or source file to play
Parameters: Type attribute: string action: Specifying MIME type for embedded plug-in
Parameters: Width Property: Any integer value function: Specifies the width of the RealPlayer element
Some functions, methods and processes of RealPlayer
This is all the functions and methods of the real Player ActiveX control Library (Version 1.0) that are interesting to study.
function getsource:widestring;
Procedure SetSource (const lpsznewvalue:widestring);
function getconsole:widestring;
Procedure Setconsole (const lpsznewvalue:widestring);
function getcontrols:widestring;
Procedure Setcontrols (const lpsznewvalue:widestring);
function Getnolabels:wordbool;
Procedure Setnolabels (Bnewvalue:wordbool);
function Getautostart:wordbool;
Procedure Setautostart (Bnewvalue:wordbool);
function Getautogotourl:wordbool;
Procedure Setautogotourl (Bnewvalue:wordbool);
function Getvolume:smallint;
Procedure SetVolume (Nvol:smallint);
function Getmute:wordbool;
Procedure Setmute (Bmute:wordbool);
function Getloop:wordbool;
Procedure Setloop (Bval:wordbool);
function Getimagestatus:wordbool;
Procedure Setimagestatus (Benable:wordbool);
function Getpacketstotal:integer;
function Getpacketsreceived:integer;
function Getpacketsoutoforder:integer;
function Getpacketsmissing:integer;
function Getpacketsearly:integer;
function Getpacketslate:integer;
function Getbandwidthaverage:integer;
function Getbandwidthcurrent:integer;
Procedure Doplaypause;
Procedure Dostop;
Procedure Donextitem;
Procedure Doprevitem;
function Canplaypause:wordbool;
function Canstop:wordbool;
function Hasnextitem:wordbool;
function Hasprevitem:wordbool;
function Hasnextentry:wordbool;
function Haspreventry:wordbool;
Procedure Donextentry;
Procedure Dopreventry;
Procedure AboutBox;
Procedure Editpreferences;
Procedure Hideshowstatistics;
function Isstatisticsvisible:wordbool;
Procedure Dogotourl (const url:widestring; const target:widestring);
Procedure Doplay;
Procedure Dopause;
function Getposition:integer;
function Getplaystate:integer;
function Getlength:integer;
function gettitle:widestring;
function getauthor:widestring;
function getcopyright:widestring;
function Getclipwidth:integer;
function Getclipheight:integer;
function Canplay:wordbool;
function Canpause:wordbool;
Procedure SetPosition (Lposition:integer);
function Getnumloop:integer;
Procedure Setnumloop (Lval:integer);
function Getcenter:wordbool;
Procedure SetCenter (Bval:wordbool);
function Getnologo:wordbool;
Procedure Setnologo (Bval:wordbool);
function Getmaintainaspect:wordbool;
Procedure Setmaintainaspect (Bval:wordbool);
function getbackgroundcolor:widestring;
Procedure SetBackgroundColor (const pval:widestring);
function Getstereostate:wordbool;
function Getlivestate:wordbool;
function Getshowstatistics:wordbool;
Procedure Setshowstatistics (Bval:wordbool);
function Getshowpreferences:wordbool;
Procedure Setshowpreferences (Bval:wordbool);
function Getshowonmouseover Wordbool;
Procedure Setshowabout (Bval:wordbool);
function Getoriginalsize:wordbool;
Procedure Setoriginalsize;
function Getdoublesize:wordbool;
Procedure Setdoublesize;
function Getfullscreen:wordbool;
Procedure Setfullscreen;
function Getenablecontextmenu:wordbool;
Procedure Setenablecontextmenu (Bval:wordbool);
function Getenableoriginalsize:wordbool;
Procedure Setenableoriginalsize (Bval:wordbool);
function Getenabledoublesize:wordbool;
Procedure Setenabledoublesize (Bval:wordbool);
function Getenablefullscreen:wordbool;
Procedure Setenablefullscreen (Bval:wordbool);
function Getenablemessagebox:wordbool;
Procedure Setenablemessagebox (Bval:wordbool);
Procedure Settitle (const pval:widestring);
Procedure Setauthor (const pval:widestring);
Procedure Setcopyright (const pval:widestring);
function Getwantkeyboardevents:wordbool;
Procedure setwantkeyboardevents (Bwantsevents:wordbool);
function Getwantmouseevents:wordbool;
Procedure setwantmouseevents (Bwantsevents:wordbool);
function Getnumentries:smallint;
function Getcurrententry:smallint;
function Getentrytitle (uentryindex:smallint): widestring;
function Getentryauthor (uentryindex:smallint): widestring;
function Getentrycopyright (uentryindex:smallint): widestring;
function Getentryabstract (uentryindex:smallint): widestring;
Procedure Setcanseek (Bcanseek:wordbool);
function Getcanseek:wordbool;
function Getbufferingtimeelapsed:integer;
function Getbufferingtimeremaining:integer;
function Getconnectionbandwidth:integer;
function getpreferedlanguagestring:widestring;
function Getpreferedlanguageid:integer;
function Getusercountryid:integer;
function Getnumsources:smallint;
function Getsourcetransport (nsourcenum:smallint): widestring;
function Getwanterrors:wordbool;
Procedure Setwanterrors (Bval:wordbool);
function Getshuffle:wordbool;
Procedure Setshuffle (Bval:wordbool);
function getversioninfo:widestring;
function getlastmessage:widestring;
function Getlasterrorseverity:integer;
function Getlasterrorrmacode:integer;
function Getlasterrorusercode:integer;
function getlasterroruserstring:widestring;
function getlasterrormoreinfourl:widestring;
Procedure Setprefetch (Bval:wordbool);
function Getprefetch:wordbool;
Procedure Setregion (const pval:widestring);
function getregion:widestring;
function Getisplus:wordbool;
function Getconsoleevents:wordbool;
Procedure setconsoleevents (Bval:wordbool);
function Getdrminfo (const pval:widestring): widestring;
Property Controlinterface:irealaudio read Getcontrolinterface;
Property Defaultinterface:irealaudio read Getcontrolinterface;
Guide to the use of WMP video control in Web pages
Wmplayer.controls.currentPosition = wmplayer.currentMedia.duration * (i/100)
//
//
//
-Playback methods and properties
In addition to playing, pausing, and stopping, the media player can also use the following properties:
Scanning (scanning)-similar to the Fast forward rewind function of the VCR;
Search (seeking)--moves directly to the specific staged time marked in the clip;
-Play
The media Player provides two techniques for specifying the media name (clip) to play, you can set the FileName property, or call the Open method. If the value of the AutoStart property is true, the movie clip will start playing when the FileName property is set to the URL of the movie clip, otherwise the movie clip will not start playing unless you call the play method. The Open method begins to play asynchronously, unlike the play method, which starts playing until the other process is finished.
The media Player provides the following video-like properties and methods to control the playback of streaming media:
Play, Stop, Pause method, to start, stop, pause streaming media.
Playcount property to set the number of times the file is played.
Autorewind property to determine whether to return to the beginning of the movie clip when the playback is stopped.
-Audio control
The media Player provides the following properties to manage audio:
Balance property to determine the sound balance of the left and right speakers;
Volume property, used to increase or decrease the volume;
Mute property, which is used to close or turn on sound;
※ You can set the Showaudiocontrols property to True to add controls that handle sounds in the control bar.
-Scan
The media Player provides the following properties for scanning:
Fastforward method, Fast forward;
Fastreverse method, quick pour;
Rate property, change playback rate;
※ You must set the Canscan and Allowscan properties to True if you want the movie clips to be scanned.
-Search
The properties for the search are:
Markercount attribute, the total number of marks in the clip;
Currentmaker, Getmarkername, Getmarkertime method, used to return tag information;
Markerhit event that is triggered when a tag is encountered;
The CurrentPosition property, the current position (measured in seconds), that you can use to move the playhead to the point specified in the clip;
Positionchange event that is triggered when setting the CurrentPosition property;
※ to search for any time, you must set the CanSeek property to True and the Canseektomarkers property must be set to TRUE if you want to search for a tag point.
-The appearance interface of the media Player
in a Web page, you can control which parts of the media Player appear and which parts do not appear by using related properties. The
Media Player includes the following elements:
Video display panel,
Border: Video bezel,
Closed captioning display Panel, subtitle display panel, Track Bar;
Control bar with Audio and Position Controls: Controls with sound and position controls;
Go to bar: Goto bar;
Display Panel: Display panel;
Status bar: status bar;
The following properties determine which element to display:
Showcontrols property: Whether to display control bars (including playback controls and optional sound and position controls);
Showaudiocontrols property: Whether to display a sound control (mute button and volume slider) in the control bar;
Showpositioncontrols Property: Whether the position control is displayed in the control bar (including backward jump, fast rewind, fast-forward, forward jump, Preview each clip in the playlist);
Showtracker Property: Whether to display the search bar;
Showdisplay property: Whether to display a display panel (information to provide programs and clips);
Showcaptioning Properties: Whether the caption display panel is displayed;
Showgotobar property: Whether to show go to column;
ShowStatusBar property: Whether the status bar is displayed;
The
-playlist
Media Player provides the following methods to access clips in the playlist:
Next method, skip to the next clip in the Show (playlist),
Previous method, and jump back to the previous clip in the program;
One feature of the media Player is the ability to preview each clip in a program, using the following properties: The
PreviewMode property determines whether the media player is currently in preview mode;
Canpreview property to determine whether the media Player is in preview mode;
In the Windows Media metafile, you can specify the preview time--previewduration for each clip, and the default preview time is 10 seconds if not specified.
You can also use the Windows Media metafile to add watermarks and banners, and the meta file also supports seamless flow switching when inserting ads.