HD video with true 5.1 channel surround sound, multiple subtitles and audio track support, smooth playback with hardware acceleration, and the ability to download everything you watch online. And with support for DIVX, AVI, MKV, MP4 and MOV, Web Player is a great choice to publish video to your website or blog. DivX Web Player now supports DivX Plus Streaming™ so you can enjoy purchased movies and TV shows without buffering right in your browser
The DivX Plus Web Player plug-in gives any webmaster a simple and hassle-free mechanism for offering DivX (DivX/AVI) and DivX Plus HD (MKV/H.264) videos for immediate download and playback on their website by simply hosting the video ﬁle and editing some HTML tags.
The DivX Plus Web Player plug-in works by being downloaded and installed on each of your visitor’s computer when they browse a page that contains an embedded a DivX video, and is distributed for free by DivX - saving you the trouble of hosting the plug-in yourself or having to pay for the bandwidth of its download.
|DivX Web Player Embedding Guide.pdf||861.76 KB|
For this simple example, we’ll assume that you have a DivX video ﬁle named movie.divx and that you are creating an HTML page named movie.html to host it. We will also assume that those two ﬁles will be uploaded to your web server in the same destination folder. Finally we will assume that the video resolution of the movie.divx ﬁle is 320x240 pixels.
All you need to add inside the <body> tag of your movie.html ﬁle is the following block of code:
<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="320" height="260" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"> <param name="src" value="movie.divx"/> <embed type="video/divx" src="movie.divx" width="320" height="260" pluginspage="http://go.divx.com/plugin/download/"> </embed> </object>
The explanation of the different tags and parameters of this block of code is as follows:
Both of these tags must be present, even though this way some parameters are repeated, in order for the plug-in to appear and function in all supported browsers.
Here is a detailed list and explanation of the required parameters of each tag:
This is all you need to add to your HTML to obtain a web page that downloads and plays DivX video.
HTTPS and HTTP authentication (i.e. http://user:firstname.lastname@example.org) are not supported.
Proper MIME type configuration is essential for client-side plug-in discovery to function in Firefox
|File Extension||MIME Type|
Create or add the text below to your Apache server’s root .htaccess file:
AddType video/divx .divx AddType video/divx .avi AddType video/divx .mkv
More information on Apache MIME types and .htaccess files can be found here:
DivX Web Player supports the standard DivX format (.divx and .avi), the H.264-based DivX Plus (.mkv) video format, and the MP4 (.mp4 .m4v and .mov) format. We recommend publishing in DivX Plus as our H.264 codec will allow you to deliver better quality video at a lower bitrate than standard DivX.
As per the w3c standard,each tag, for example:
<object id="ie_plugin" … > <embed id="np_plugin" … ></embed> </object>
In this case we have named the object tag ie_plugin and the embed tag np_plugin.
The ﬁnal step required to be able to script the plug-in is to add some code that will determine which plugin object name to use, depending on the browser that is currently using the plug-in. This is done by parsing the “user agent” string that identiﬁes the browser.
This block of code assigns the correct document object into the variable plugin by detecting whether the current browser is Internet Explorer or Safari, or something else.
The following callback parameters are deﬁned:
function myStatusCallback (event)
In this case “myStatusCallback” is a placeholder for your function name. The event parameter will be a number. The following values are possible:
function myTimeCallback (time)
In this case “myTimeCallback” is a placeholder for your function name. The time parameter will be a long integer value giving the current playback time in seconds. This function will be called every second.
function myBufferCallback (current, total)
In this case “myBufferCallback” is a placeholder for your function name. The current and total parameters will be long integers containing the current and total amount of data (in bytes) of this buffering stage.
function myDownloadCallback (current, total)
In this case “myDownloadCallback” is a placeholder for your function name. The current and total parameters will be long integers containing the current and total amount of data (in bytes) of the downloaded video.
The following function allows querying the plugin version on the end user machine. The return value will be in the form “X.X.X” where X are single digit numbers.
Those functions can be used to alternatively set all the embedding parameters and take the same parameter values as the corresponding embedding parameters. They take effect immediately (if applicable) or during the next call to the Open() function.
void SetMode(string mode); void SetAllowContextMenu(boolean allow); void SetAutoPlay(boolean play); void SetVolume(unsigned long volume); void SetPreviewImage(string imageURL);
This function allows opening a new local video file or relative/full URL.
void Open(string URL);
void Play(); void Pause(); void Stop(); void Mute(); void UnMute(); void Seek(string method, unsigned long percent); // seeks into the video, method can be “DOWN”, “UP”, or “DRAG” to simulate mouse interaction. Call “DOWN” and “UP” in sequence to perform a full seek.
void ShowPreferences(); // shows the preferences panel void ShowContextMenu(); // shows the contextual menu void GoEmbedded(); // go back into browser-embedded mode void GoWindowed(); // go into windowed playback mode void GoFullscreen(); // go into fullscreen playback mode
These calls can only return valid data once the “OPEN_DONE” callback event has been sent by the plug-in. Otherwise the return values are undefined.
unsigned long GetTotalTime(); // in seconds unsigned long GetVideoWidth(); // in pixels unsigned long GetVideoHeight(); // in pixels unsigned long GetNumberOfAudioTracks(); unsigned long GetNumberOfSubtitleTracks(); long GetCurrentAudioTrack(); // returns the index of the currently playing audio track (or -1 if no audio track is selected)< long GetCurrentSubtitleTrack(); // returns the index of the currently playing subtitle track (or -1 if no subtitle track is selected) string GetAudioTrackName(unsigned long trackIndex); // returns a readable track name for audio track “trackIndex” (which must be between 0 and trackCount-1) string GetSubtitleTrackName(unsigned long trackIndex); // returns a readable track name for subtitle track “trackIndex” (which must be between 0 and trackCount-1) string GetAudioTrackLanguage(unsigned long trackIndex); // returns the twochar ISO 859 language code of audio track “trackIndex” (which must be between 0 and trackCount-1) string GetSubtitleTrackLanguage(unsigned long trackIndex); // returns the twochar ISO 859 language code of subtitle track “trackIndex” (which must be between 0 and trackCount-1)
These calls can be successful once the “OPEN_DONE” callback event has been sent by the plug-in for the current video.
void SetCurrentAudioTrack(long index); // sets the currently playing audio track to the audio track at index “index” (pass -1 if you want no audio track to be selected) void SetCurrentSubtitleTrack(long index); // sets the currently playing subtitle track to the subtitle track at index “index” (pass -1 if you want no subtitle track to be selected)
If you want to prevent DivX Plus Web Player from saving the downloaded video file onto the end user’s hard drive, you can simply name your video file so that its filename on your web server ends with “_ns” (for “no save”) just before the .divx extension and update your HTML code to reference this filename.
Examples: myvideo_ns.divx or trailer_ns.divx.
In this case DivX Plus Web Player will still download the file contents for playback but will not allow the end user to save the full file on disk.
Each of the following embedding parameters allow you to customize the appearance and behavior of the DivX Plus Web Player plug-In. Each of them must be speciﬁed twice for them to take effect in all supported browsers, once in the <object> tag as a <param> sub-tag, and once in the <embed> tag directly.
The allowContextMenu parameter is used to specify whether the plugin should display a contextual (right-click) menu when the user presses the right mouse button or the menu buttons on the skin.
You may wish to disable the contextual menu to provide your own controls on the page.
UPDATE – 4/7/2010: This parameter is under maintenance and may not function desirably. We recommended removing this parameter from your embed code until further notice.
The bannerEnabled parameter is used to specify whether the plugin should display the DivX advertisement banner at the end of playback.
The bufferingMode parameter is used to specify how the plug-in should buffer downloaded data before attempting to start playback.
The loop parameter is used to specify whether the plugin should play the video in a loop or stop video playback when the end of the ﬁle is reached.
The minVersion parameter is used to specify a minimum version number of the DivX Browser Plug-In that is required to play the embedded video.
This parameter can be used to force an upgrade of the client computer when your web page explicitly relies on a speciﬁc version of the DivX Browser Plug-In to playback the video. If the end user refuses to upgrade, the video will not download or play.
The mode parameter is used to specify which skin mode the plugin should use to display playback controls. Several modes are provided from showing no controls at all to showing a full-featured playback panel.
The movieTitle parameter is useful if your videos don’t have user friendly ﬁle names such as “112356.divx” or “gr8t_vidz_1324.avi” as it allows to give a title to your video that is used by the DivX Web Player when showing UI elements and when users wants to save the video ﬁle to their Hard Disk.
If you set movieTitle to “My Great Video” then your video ﬁle will be saved on each user’s computers as “My Great Video.divx”.
The previewImage parameter is used to specify the location of an image ﬁle in PNG, JPEG or GIF format to use as a preview image. The preview image is displayed in place of the DivX “X” logo when autoPlay is set to false. This allows to setup a piece of video so that it does not auto start but shows a preview image of what the video is about.
Users can then start the download and playback of the video by clicking anywhere on the preview image. See the previewMessage and previewMessageSize parameters for more options.
Note that you need to set the autoPlay parameter to false for this parameter to be taken into account.
The previewMessage parameter allows to display a text message on top of the preview image to let users know how to start the video. The message can be any text such as “Click to play video”.
Note that you need to also set the previewImage parameter for this parameter to be taken into account.
The previewMessageFontSize parameter allows to customize the size of the font used to display the preview message over the preview image.
Note that you need to also set the previewImage and previewMessage parameters for this parameter to be taken into account.
The src parameter is used to specify which video ﬁle the plug-in should attempt to download and play. This ﬁle should have an “.avi”, “.divx” or “.mkv” extension.
The DivX Plus Web Code Generator allows you to create a small piece of code that can be inserted into your website to display and playback DivX/AVI and DivX Plus HD (MKV/H.264/AAC) videos.
If you can copy and paste, you have enough know-how to stream a DivX video from your site. If you scoff at automatic HTML code generators, then our Web Developer Guide is for you.