Asp.net Media Player Embed
Using the Windows Media Player Control in a Web Page
Just before few years video was rarity on web sites, mostly because Internet connection for many people was slow. Today almost everyone have high speed connection and video on web site is used where is needed, depending only of webmaster s needs.
Yet, ASP.NET don t have some specific method for showing video files. There are many options, more or less complex that you need to consider and select the most appropriate one. Also, there are many video formats used, problems with web browser compatibility, different client operating systems etc.
The fast and easy ways to play video on web page
Internet Explorer has interesting dynsrc parameter for the tag. The code can look like this:
img
dynsrc MyVideo.avi
/
This will show video only by using simple image HTML tag. But, it is not compatible with every web browser. In fact, it works only with Internet Explorer, but it can be satisfactory solution in some scenarios.
More compatible solution is to use 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
Instead of using of tag, W3C recommends tag. Here is the code to display WMV video file with HTML tag:
object
height 320px
width 240px
type video/x-ms-wmv
param
name src
value
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 HTML tag with code like this:
OBJECT
width 312px
height 248px
CLASSID CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6
VIEWASTEXT
PARAM
name autoStart
value False
name URL
value. /Movie/Pljacka.wmv
name enabled
value True
name balance
value 0
name currentPosition
name enableContextMenu
name fullScreen
name mute
name playCount
value 1
name rate
name stretchToFit
name uiMode
value full
OBJECT
To show video file in Media Player control, you need to place proper HTML code into the web form. As you can see, this code contains one tag with some tags inside which represents Media Player properties. By using these properties you can adopt Media Player look an feel to your web site design. The tag contains width and height properties to set Media Player control size, and also CLASSID property. This property value is CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6. Somewhere on the Internet you can find other value clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95. Second value is for older versions of Media Player, up to version 6.4. For Media Player version 7 or later, you should use first id.
Display Media Player control in Firefox web browser
Firefox web browser uses or 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. Then, if test video file is played correctly, you can try to play your video file with HTML code like this:
EMBED
width 416px
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.
You can download ASP.NET Media Player Control assembly, compiled with ASP.NET 1.1, ASP.NET 2.0 or ASP.NET 3.5. Complete source code is available in both Visual Basic. Net and C programming languages.
How to use ASP.NET Media Control on web page
To use ASP.NET Media Control in your web project, you need to follow these simple steps:
1. Download the package and unzip it somewhere.
2. Add ASP.NET Media Control to Visual Studio toolbox
ASP.NET Media Player Control added to toolbox
3. Place control to web page.
ASP.NET Media Player Control on web form
4. Set control s properties. You are required to set MovieURL property, to set absolute or relative URL to file. All other properties you need to set only if you don t want its default value. All properties related to playing media are located inside of Settings category.
Control s properties
5. Start the web application and enjoy the movie.
ASP.NET Media Player Control at run time
Conclusion
I tested this ASP.NET control in Internet Explorer and Firefox web browsers and it worked fine. In both cases it render correct HTML and Media Player plays. wmv file. Of course, this software is still not tested enough. If you find some bug or you have an idea which new feature to add to control please let us know.
Going professional with ASPNetVideo
To get access to all Media Player options and to embed QuickTime or RealPlayer into ASP.NET web site, try ASPNetVideo. ASPNetVideo control provides search engine optimization, protected video files, custom user interface and more. For 49 you can use it on single site or just 99 for use on unlimited number of web sites. Things like no ongoing subscription costs, free future updates or 30 days money back guarantee justify decision to give it a try.
Tutorial toolbar: Tell A Friend Add to favorites Feedback Google
comments powered by.
Video Starter Kit is a complete solution for building highly scalable, professional, feature rich social media content sharing web site.
Embedding the Windows Media Player control in a webpage lets you completely customize the way the user interacts with the control. You can use the interface provided by the control, or you can hide it and display your own user interface. You can specify multiple Windows Media Player control properties at the point where you embed the control, or you can set Player properties and call Player methods in script code.
The following sections describe the basics of embedding the control in a webpage.
Note The Windows Media Player 10 Mobile control contains functionality based on a subset of the functionality provided in the desktop version of the Windows Media Player control. Therefore, it can be embedded in a Pocket Internet Explorer webpage the same way the desktop control is embedded in an Internet Explorer webpage. To find out whether a particular method, property, or event is supported for the Windows Media Player 10 Mobile control, see Object Model Reference for Scripting.
Related topics
Player Control Guide.
Add video to your website with stylish popup video effect. Now for Windows and Mac.
I ve found some examples of. AVI in html on the web. But my page is problematic. It s fine with chrome on my pc. In.
ASP.NET C Dynamically Creating HTML DIVS: The problem is at products_holder div I am creating number of buttons at run time.
How to build ASP.NET Media Player Control
Conclusion. I tested this ASP.NET control in Internet Explorer and Firefox web browsers and it worked fine. In both cases it render correct HTML and Media Player.
WP Media Player is a Silverlight based media player plugin for WordPress. It is used for playing self-hosted video files as well as for videos hosted on external.
Project Description ASP.NET Embedded Video Player YouTube API, C ASP.NET API, writtent in C, enables customization of the embedded YouTube video player.
Project Description Embed YouTube object into ASP.NET AJAX-extended web page; build simple dynamic playlist control. DEMO. Project contains: 1. Default Web page.
ASP.NET Media Player Control is FREE custom ASP.NET control that makes easier using of Windows Media Player on web page with ASP.NET server side code.