In recent years, the names of video on demulting VOD (Video On Demand) have more and more in the media.
VOD technology allows people to share the video programs and information in the program library in the computer or TV, which can be freely placed in a computer or TV with a video program, a video program and information in a computer or television, which is a video program and information that can be freely selected. .
The essence of the VOD is that the user's user actively obtains multimedia information according to their needs, which distinguishes the maximum difference between the information release: First, the second is selectivity. In a sense, this is the case of information recipients according to their own needs, in this way, this way will become more and more in accordance with the deep needs of information resource consumers in today's information society, can say that VOD is The future mainstream mode of information acquisition is in multimedia video audio. The concept of VOD will expand quickly in the field of information, with unlimited development prospects.
【background】
The unit of the author has an internal website, in order to further improve the availability of the network, improve the functionality of the website, decide to provide video on demand functions on the network. After a period of exploration and comparison, the author finally selected RealSystem's RealPlayer as a video file playing tool, mainly based on the following considerations:
1. RealPlayer supports the vast majority of audio and video streaming media formats, including currently popular MP3 and other audio media;
2, RealPlayer default .RM format while ensuring playback quality, the file compression ratio is higher to make it more beneficial to network transmission;
3, RealPlayer has a wide range of user groups and service providers on the Internet.
Alternatively include Microsoft's MediaPlayer, Apple's QuickTime, etc. For details, please refer to the "Search for Spring" evaluation article: "Three major mainstream streaming media technology comparison" (http://www.souxin.com/stream/txt/3_stream_comp/www.souxin.com.htm)
[Selection of playback]
In general, after installing RealPlayer, there are two ways to choose to connect to the video file. One is the URL address that provides video files directly on the web page. When the user clicks on the link, RealPlayer automatically recognizes and lives in real time; the second method is to embed the RealPlayer object in the web page through the ActiveX control, and via DHTML Dynamically specify a video stream URL for embedded objects, providing a unified friendly interface for video playback.
The former method is relatively simple for designers, and only the playback path of the video file is required. The skilled users of RealPlayer can also perform video management by customizing the visual plugin, adding a visual plugin, adding to a favorites. But this method also has the following defects:
1. For video files containing Chinese paths and Chinese names, the browser does not support well, often can't find an error message such as files.
2, you need a system for file association, if the file is associated, the browser will be at a loss.
3. For end users, it is often desirable to see a unified playback interface instead of pop-up playback.
With web embedded video stream management, the user-ended operation request can be reduced to minimize (the user only needs to install the RealPlayer player). If reciprocally, you can customize the beautiful play interface according to the designer's willingness.
【basic concepts】
Before designing, let's first understand some relevant basic concepts.
1,
The RAM format file is the same as the RM file, and it is also the video file compression format supported by RealPlayer, where the RAM file can only include the URL address of the video file. That is, the RAM file can be a simple text format, and each line defines the URL address of a video file.
The author found that when playing video files, the author is typically played locally when playing a video file. This is unbearable for larger video files. The method of solving this problem, one is to simply split video files into small file segmentation playback (due to Real "Closed Management" on RM format, RM is not like a video file such as MPEG. Edit the video software); another is the use of a RAM file. RealPlayer Simple Download the RAM file in the text format, then remove the real address, and then automatically connect to the network for real-time point-to-point playback. The disadvantage is to increase the server burden.
Similarly, Microsoft Media Player uses ASX format to define an ASF file.
3, DHTML
DHTML is the abbreviation of Dynamic HTML, DHTML uses CSS (Cascading Style Sheets, Table), and relying on JavaScript to "move" with JavaScript. Netscape 4.0 and IE 4.0 / 5.0 support DHTML, DHTML is a fully "client" technology that implements interactivity between the page and the user directly through the web page. Excellent in DHTML is to enhance the functionality of the web page, establish an animation, games, and application software, etc., provide a new way of browsing sites, different from Java, Flash, etc., the page prepared with DHTML No need to support support will be fully implemented.
【designing process】
The following author uses IE5.0 as an example, a method of implementing an embedded web video on demand system, wherein some PHP and JavaScript technology are used, and if there is a doubtable reader, please refer to the relevant information.
First, insert the RealPlayer ActiveX object (if you want to test, you need to install the RealPlayer player first)
Assume that the following code is included in the Video.php document (this file will be linked via
object> // Define play interface
Object> // Define Status Bar
Object> // Define Control Panel
Among them, the Controls parameter is used to specify the appearance of the control of the player, and can be combined with multiple controls and associated with the console parameter.
For Param parameters, readers can refer to RealPlayer official website http://service.real.com/help/library/guides/Production/htmfiles/Control.htm.
The SRC parameters here are particularly important, used to specify the URL address of the video stream file. Here, the author uses the PHP code to dynamically specify the SRC, and the reader can also use other as ASPs, or fully through the JavaScript.
Second, use DHTML dynamic control of the playback of the RealPlayer control
Tips:
The following code is included in the main page:
Iframe>, where the video.php file is used to display the RealPlayer control. Below we join simple JavaScript code to control video playback.
Function Play (filename) {
Top.Document.all ("iVideo"). SRC = "VIDEO.PHP? SRC =" FileName;
} // iVideo is the identifier of the IFrame just defined
script>
We can use JavaScript to control the more complex feature of the RealPlayer plugin, such as extracting video's long width, testing users' network rate, custom play events, etc. For specific details about RealPlayer ActiveX, see RealPlayer Official Website http://service.real.com/help/emrary/guides/extend/embed.htm.
We assume that there is a video file, its URL is http: //yoururl/filename.ram, then we can define this:
File 1 If the file is in local, the URL can also be a relative path.
Third, detect whether the user is installed a RealPlayer player
Add the following JavaScript code to the
head> section of the page to detect if the user installs the RealPlayer player:
VAR realMode = 0;
Var RealPlayer5 = 0;
Var RealPlayer4 = 0;
Var RealPlayerg2 = 0;
IF (Navigator.UserageRagent.indexof ("MSIE") <0) {
Numplugins = navigator.plugins.LENGTH;
For (i = 0; i Plugin = navigator.plugins [i]; IF (plugin.name.substring (0, 10) == "realplayer") { Realmode = 1; } } } // The following code creates a RealPlayer object through the CreateObject () function of VBScript. Document.write (' / n'); Document.write ('On Error ResMe next / n'); Document.write ('RealPlayerg2 = (CreateObject ("RMocx.RealPlayer G2 Control") / n'); Document.write ('RealPlayer5 = (CreateObject ("RealPlayer.RealPlayer (TM) ActiveX Control (32-bit))) / n') Document.write ('RealPlayer4 = (CreateObject ("Realvideo.RealVideo (TM) ActiveX Control (32-bit)))) / n'); Document.write (' script /> / n') ; IF (RealPlayerg2 || RealPlayer5 || RealPlayer4) { / / You can add } else if (realmode) {// Netscape browser user / / Can add } else { Window.Location.Replace ("install.htm"); // Transfer to install.htm page Guide users to install } -> Script> At this point, we have implemented a basic function of web-based video on demand. But we must want to make more perfect, but also other more complex considerations. If the streaming media is produced, the design of the web is designed, the network flow rate is considered, and the effective organization of the website video file. These topics have exceeded the scope of this article, and readers should be referred to the relevant information.