Practical code analysis for adding a player to a webpage

Source: Internet
Author: User

The Player we see on the web page is nothing more than WMP/RealOne/Macromedia Flash Player. Others are different from panel or other controls are added, some players installed on the computer are also integrated with the decoder. The core encoding and decoding technologies are the same. For example, the most popular windows media streams on the network (asf, wma, wmv format ...), real stream (rm, rmvb ...), there are also MPEG series encoding formats (MP4/MP3 format ...)

Windows Media Video is a streaming Media Format launched by Microsoft. It is extended in the "same-door" ASF (Advanced Stream Format) Format upgrade. in the same video quality, the WMV format is very small, so it is suitable for online playback and transmission. Windows Media Player9 is compatible with all formats of WMV. The official Encoder is Windows Media Encoder. However, if you want to convert high-quality wmv files, you must have a large memory to process data...

I accidentally discovered that the CASTPOST player can define its own size. Online playback in WMV format can be said to be fast enough, then I spent a lot of effort to put some wonderful short films and some classic MTV into the WMV format. Although I cannot download them now, as long as there are not too many connected people, playing is still very smooth ^_^

WMP is added with the ActiveX decoder control, which not only supports playing music, but also Flash and other video files.

<Object align = middle classid = "CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95" class = OBJECT id = MediaPlayer width = 196 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 = " n/nsmp2inf. cab # Version = 5, 1, 52,701">

To use WMP for continuous playback, please refer to the ASX element file usage instructions: use ASX playlist

The above player is old-fashioned, version 6.4! The new player appeared after MediaPlayer9.0. That is to say, it can be used normally only when 9.0 or more players are installed.


The following is the new player code, which is much simpler than before:

<Object id = "player" height = "64" width = "260" classid = "CLSID: 6BF52A52-394A-11d3-B153-00C04F79FAA6">
<Param NAME = "AutoStart" VALUE = "-1">
<! -- Automatic playback? -->
<Param NAME = "Balance" VALUE = "0">
<! -- Adjust the left-right channel balance and the old player code above -->
<Param name = "enabled" value = "-1">
<! -- Whether the player can be controlled by humans -->
<Param NAME = "EnableContextMenu" VALUE = "-1">
<! -- Enable context menu -->
<Param NAME = "url" value = "/blog/1.wma">
<! -- Playback file address -->
<Param NAME = "PlayCount" VALUE = "1">
<! -- Control the number of playbacks, which is an integer -->
<Param name = "rate" value = "1">
<! -- The playback speed is controlled. 1 is normal, and decimal places are allowed. -->
<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">
& Lt

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: 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.