Software Programs and Projects

This Software Programs and Projects include programing tips and technology using different languages like VC++,ASP,JSP C#.Net,PHP,VB.Net,JavaScript,ASP.NET .Software Programs and Projects blog mainly support to software programmers and provide help through the mail.

Media Player in Internet Explorer and Mozilla FireFox


IE has interesting dynsrc parameter for the tag. The code can look like this:

<img dynsrc="MyVideo.avi" />



More compatible solution is to use <embed> tag. This solution is better since it is supported by different web browsers (notice that it is not recommended by W3C as standard HTML). Code can look like this:

<embed src="MyVideo.avi"></embed>


Instead of using of <embed> tag, W3C recommends <object> tag. Here is the code to display WMV video file with <object> HTML tag:


<object height="320px" width="240px" type ="video/x-ms-wmv">
<param name="src" value="http://localhost/MyMovie.wmv" />
</object>




Display video with Media Player active X control in Internet Explorer

More flexible way to show video on your ASP.NET web site is to use Windows Media Player active X control. Media player is probalbly already used by most of your site visitors. So they feel familiar with it. Also, Media Player supports many different file types. This control in Internet Explorer web browser is presented with <object> HTML tag with code like this:


<OBJECT width="312px" height="248px" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>
<PARAM name="autoStart" value="False">
<PARAM name="URL" value="./Movie/Pljacka.wmv">
<PARAM name="enabled" value="True">
<PARAM name="balance" value="0">
<PARAM name="currentPosition" value="0">
<PARAM name="enableContextMenu" value="True">
<PARAM name="fullScreen" value="False">
<PARAM name="mute" value="False">
<PARAM name="playCount" value="1">
<PARAM name="rate" value="1">
<PARAM name="stretchToFit" value="False">
<PARAM name="uiMode" value="full">
</OBJECT>







Display Media Player control in Mozilla FireFox

Firefox uses <object> or <embed> tags to show Media Player control. Before you try this, Firefox needs the Windows Media Player browser plugin installed. You can download the plugin here. After you install a plugin, you can check is it installed correctly on Windows Media Player Plugin Test Player (XP/Vista).


<EMBED type="video/x-ms-wmv" width="416px" height="320px" autostart="False" URL="./Movie/Pljacka.wmv" enabled="True" balance="0" currentPosition="0" enableContextMenu="True" fullScreen="False" mute="False" playCount="1" rate="1" stretchTofit="False" uiMode="3">


Media Player Control properties

Available Media Player control properties are shown in table bellow.
Property Default value Description
AudioStream true
AutoSize true
AutoStart true Would movie start when page is loaded
AnimationAtStart true Would animation will play until video file is loaded
AllowScan true
AllowChangeDisplaySize true
AutoRewind false
Balance false
BaseURL
BufferingTime 5
CaptioningID
ClickToPlay true Would Media Player start when user clicks.
CursorType false
CurrentPosition true
CurrentMarker false
DefaultFrame
DisplayBackColor false
DisplayForeColor 16777215
DisplayMode false
DisplaySize false
Enabled true
EnableContextMenu true
EnablePositionControls true
EnableFullScreenControls false
EnableTracker true
Filename URL Set the absolute or relative URL of file to play.
InvokeURLs true
Language true
Mute false
PlayCount 1
PreviewMode false
Rate 1
SAMILang
SAMIStyle
SAMIFileName
SelectionStart true
SelectionEnd true
SendOpenStateChangeEvents true
SendWarningEvents true
SendErrorEvents true
SendKeyboardEvents false
SendMouseClickEvents false
SendMouseMoveEvents false
SendPlayStateChangeEvents true
ShowCaptioning false
ShowControls true Show Media Player controls or not.
ShowAudioControls true Are audio controls visible or not.
ShowDisplay false Is display visible or not.
ShowGotoBar false Is GotoBar visible or not.
ShowPositionControls true
ShowStatusBar false
ShowTracker true
TransparantAtStart false
VideoBorderWidth false
VideoBorderColor false
VideoBorder3D false
Volume -200
WindowlessVideo false

As you can see, Windows Media Player control has many properties. You are not required to set it all. If some property is not used, then control uses its default value. Of course, some property like FileName we must use if we want to play anything.
Custom ASP.NET Media Player Control

Placing static HTML code for Media Player control will not be very efficient method. It is much better to make custom ASP.NET server control which will render correct HTML code depending of property values. This custom control can be used easily by ASP.NET web application, to show play lists, to remember user preferences etc.Control will automatically detect web browser type and render appropriate HTML code.


tag:- How to Place Media Player Control In Mozilla FireFox ,Internet Explorer using ASP.NET