Media Player Skin Code
Get help and how-to for Windows Media Player 11 for Windows XP and Windows Vista, and Windows Media Player 12 for Windows 7 and Windows 8.
VLC media player, free and safe download. VLC media player 2.2.1: Simply the best multi-format media player. If you want to play video or music files in just about.
Windows Media Player 12 is the next version of microsoft windows media player to be bundled with Windows 7. In an earlier post, we detailed the features of Windows.
Silverlight Media Player SDK currently 1 on Google with extended customization features allows setting initial values and adding chapters.
Official page for VLC media player, the Open Source video framework.
Download latest VLC source code. If you want, you can download the source code of VLC media player. Download VLC for Windows x64 64 bits installer Exe installer.
VLC Media Player is free for download under the General Public License. Vlc Medai Player features open-source software so users can play any file format.
Project Description
Silverlight Media Player SDK currently 1 on Google with extended customization features allows setting initial values and adding chapters programmatically. It s developed in C ASP.NET, AJAX and is compatible with Silverlight versions 2.0/3.0/4.0.
DEMO:
NOTE: THIS CONTENT IS SHOWN FOR INFORMATION/DEMO PURPOSE ONLY. PLEASE DO NOT COPY/DISTRIBUTE
INTRODUCTION
Embedded media players video/audio represent the cornerstone components of modern rich internet applications RIA, extending the web page interactivity, responsiveness, aesthetic appeal and overall user experience. Adobe Flash implemented, for
example, in YouTube has tremendous installation base worldwide and currently dominates this sector of technology. At the same time, relatively new but rather promising technologies are actively penetrating the market of rich internet applications,
most notably: Microsoft Silverlight and HTML 5.0.
Silverlight provides extremely powerful RIA development platform, helping to bridge the gap between web applications and their desktop counterpart in terms of user experience and dynamic content streaming. As an example, the latest highly sophisticated
web-based HD video player, developed by Netflix, is built on the Silverlight technology set and is compatible with all major web browsers, including the most popular Internet Explorer and Firefox. Silverlight is backed by a full power
of Microsoft. NET technological framework and its sophisticated integrated development environment Visual Studio 2008/2010.
Silverlight Media Player, described in this article, implements application program interface API, written in C. It provides plenty of customization features, such as setting the auto-play options, adding chapters, dynamically changing
the visual styles so-called skins, etc.
PROJECT CONTAINS:
1. Default Web page Default.aspx with corresponding code behind: both to be placed in Application root directory ASP.NET 2.0
2. Silverlight Library file to be placed in Bin application directory
3. Ajax Library file AjaxControlToolkit.dll to be placed in Bin application directory
4. Player Styles Skin files xaml collection, placed in MediaPlayerSkins folder
5. Player Initial setting stored in XML document file SilverlightMediaPlayer.xml
6. Media Item data stored in XML document file SilverlightMediaItems.xml
7. Custom Silverlight Player XML reader/parser class library SilverlightPlayerLib.dll stored in Bin application directory
Available Styles include:
AudioGray Basic Classic Console Expression Futuristic Professional Simple
NEW. Also, check the new version of embedded YouTube Video player ASP.NET SDK written in C implementing the latest HTML5/CSS3 features click on the image below
SIMPLE SOLUTION AS DESCRIBED IN PREVIOUS RELEASE
Listing 1. Following Demo page contains all necessary components in order to run a Silverlight Media Player:
Page Language C
AutoEventWireup true
CodeFile Default.aspx.cs
Inherits _Default
DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
Register Assembly System.Web.Silverlight
Namespace System.Web.UI.SilverlightControls
TagPrefix asp
Register assembly AjaxControlToolkit
namespace AjaxControlToolkit
tagprefix cc1
html xmlns
head runat server
title SILVERLIGHT MEDIA PLAYER DEMOtitle
head
body
form id form1 runat server
asp:ScriptManager ID ScriptManager1 runat server /
asp:UpdatePanel ID UpdatePanel1 runat server updatemode Conditional
ContentTemplate
div
div style float:left
asp:DropDownList ID cmbSkins runat server
onselectedindexchanged cmbSkins_SelectedIndexChanged /
div h3 SELECT PLAYER STYLEh3 div
asp:MediaPlayer ID MediaPlayer1 runat server /
asp:UpdatePanel
hr /
h4 THIS CONTENT IS SHOWN FOR DEMO PURPOSE ONLY.h4
h4 PLEASE DO NOT COPY/DISTRIBUTE.h4
form
html
Listing 2. Following code snippets demonstrates the Media Player initial settings programming technique:
region Media Player initial settings
MediaPlayer1.AutoPlay true;
MediaPlayer1.ScaleMode System.Web.UI.SilverlightControls.ScaleMode.Zoom;
MediaPlayer1.MediaSource _source;
MediaPlayer1.PlaceholderSource _domain VIDEO/Demo/ImgMain.JPG ;
MediaPlayer1.Width 600;
MediaPlayer1.Height 440;
endregion
Listing 3. Chapters are added by the following coding pattern:
System.Web.UI.SilverlightControls.MediaChapter mc
new System.Web.UI.SilverlightControls.MediaChapter ;
mc.Position 18;
mc.ThumbnailSource ;
mc.Title Chapter1 ;
MediaPlayer1.Chapters.Add mc ;
mc null;
and the entire code behind page is looking as follows:
Listing 4. ASPX Code behind page:
//
// Module : Default.aspx.cs
// Description : code behind
// Author : Alexander Bell
// Copyright : 2009 Infosoft International Inc.
// DateCreated : 07/03/2009
// LastModified : 10/12/2009
// DISCLAIMER: This Application is provide on AS IS basis without any warranty
// TERMS OF USE : This module is copyrighted.
// : You can use it at your sole risk provided that you keep
// : the original copyright note.
//NOTE: ALL. WMV/.JPG FILES ARE FOR DEMO PURPOSE ONLY: DO NOT COPY/DISTRIBUTE.
using System;
public partial class _Default : System.Web.UI.Page
// Silverlight Media Player styles skins
protected enum MediaPlayerSkins
AudioGray,
Basic,
Classic,
Console,
Expression,
Futuristic,
Professional,
Simple
// media source
// NOTE: THIS. WMV FILE IS FOR DEMO PURPOSE ONLY: DO NOT COPY/DISTRIBUTE
//
private const string _domain ;
private string _source _domain VIDEO/Demo/WMV/JJ2008_100.wmv ;
protected void Page_Load object sender, EventArgs e
if . IsPostBack
MediaPlayer1.AutoPlay true;
MediaPlayer1.ScaleMode System.Web.UI.SilverlightControls.ScaleMode.Zoom;
MediaPlayer1.MediaSource _source;
MediaPlayer1.PlaceholderSource _domain VIDEO/Demo/ImgMain.JPG ;
MediaPlayer1.Width 600;
MediaPlayer1.Height 440;
// NOTE: ALL. JPG FILEs ARE FOR DEMO PURPOSE ONLY: DO NOT COPY/DISTRIBUTE.
region Adding Media Player chapters
System.Web.UI.SilverlightControls.MediaChapter mc
new System.Web.UI.SilverlightControls.MediaChapter ;
mc.Position 18;
mc.ThumbnailSource
;
mc.Title Chapter1 ;
MediaPlayer1.Chapters.Add mc ;
mc null;
mc new System.Web.UI.SilverlightControls.MediaChapter ;
mc.Position 37;
mc.Title Chapter2 ;
mc.Position 70;
mc.Title Chapter3 ;
mc.Position 107;
mc.Title Chapter4 ;
mc.Position 134;
mc.Title Chapter5 ;
region Dropdown Style selector
// populate dropdown with Media Player styles skin : looping through enum
foreach MediaPlayerSkins skin in Enum.GetValues typeof MediaPlayerSkins
cmbSkins.Items.Add skin.ToString ;
// set dropdown autopostback
cmbSkins.AutoPostBack true;
// select Professional style
cmbSkins.SelectedValue MediaPlayerSkins.Professional.ToString ;
MediaPlayer1.MediaSkinSource
/MediaPlayerSkins/ cmbSkins.SelectedValue . xaml ;
region User Events
///Select Media Player Skin
protected void cmbSkins_SelectedIndexChanged object sender, EventArgs e
BETTER SOLUTION
Media Player initial settings and Media Item data could be stored in a separate XML documents files, namely: SilverlightMediaPlayer.xml and SilverlightMediaItems.xml. Corresponding custom XML reader/parser class library SilverlightPlayerLib.dll has been
added to the project placed in Bin application folder. The sample structure of the XML files are shown below:
Listing 5. Media Player initial settings stored in the XML document
xml version 1.0 encoding utf-8 .
SilverlightMediaItems
SilverlightMediaItem ID 1
Title NY International Auto Show 2010Title
StartPosition 0StartPosition
ItemDuration ItemDuration
PlayLength PlayLength
AttributionVideo Alexander BellAttributionVideo
AttributionAudio Michael Lington, Various ArtistsAttributionAudio
MediaSource
PlaceholderSource
Chapters
Chapter
Position 05Position
ThumbnailSource
Title Chapter1Title
Position 46Position
Title Chapter2Title
Position 50Position
Title Chapter3Title
Position 60Position
Title Chapter4Title
Position 75Position
Title Chapter5Title
Position 102Position
Title Chapter6Title
Position 125Position
Title Chapter7Title
Position 141Position
Title Chapter8Title
Position 159Position
Title Chapter9Title
Position 250Position
Title Chapter10Title
Position 279Position
Title Chapter11Title
SilverlightMediaItem
SilverlightMediaItems
Finally, demo aspx page looks like:
Listing 7. default. aspx page demo
Inherits ASPX_Default
title SILVERLIGHT MEDIA PLAYERtitle
div style width:600px; margin-left:auto; margin-right:auto;
h2 SILVERLIGHT MEDIA PLAYERh2
h5 MEDIA PLAYER STYLE SELECTORh5
Listing 8. default. aspx demo page, code behind
// Copyright : 2010 Infosoft International Inc.
// DateCreated : 03/17/2010
// LastModified : 03/18/2010
using Infosoft_SilverlightMediaPlayer;
using System.Collections;
public partial class ASPX_Default : System.Web.UI.Page
// NOTE. WMV FILE IS FOR DEMO PURPOSE ONLY: DO NOT COPY/DISTRIBUTE
region page load
PlayerInit ref this.MediaPlayer1 ;
region select media item from XML file
SetMediaItem ref this.MediaPlayer1 ;
region player init settings from XML file
private void PlayerInit ref System.Web.UI.SilverlightControls.MediaPlayer SLP
SLMediaPlayer slm;
try
// read setting from XML file
slm new SLMediaPlayer ;
slm.GetPlayer ;
// assign values to Silverlight Media Player
SLP.Width slm.Width;
SLP.Height slm.Height;
SLP.AutoLoad slm.AutoLoad;
SLP.AutoPlay slm.AutoPlay;
// read from XML and set player scale mode
switch slm.ScaleMode
case stretch :
SLP.ScaleMode System.Web.UI.SilverlightControls.ScaleMode.Stretch;
break;
case zoom :
SLP.ScaleMode System.Web.UI.SilverlightControls.ScaleMode.Zoom;
case none :
SLP.ScaleMode System.Web.UI.SilverlightControls.ScaleMode.None;
default: break;
catch
finally slm null;
region read media item properties from XML file
private void SetMediaItem ref System.Web.UI.SilverlightControls.MediaPlayer SLP
MediaItems mi new MediaItems ;
System.Web.UI.SilverlightControls.MediaChapter mc;
// get Media item from XML
mi.GetMediaItem ;
// set Media source
SLP.MediaSource mi.MediaSource;
SLP.PlaceholderSource mi.PlaceholderSource;
// add Chapters
if mi.Chapters.Count 0
for int i 0; i mi.Chapters.Count; i
mc.Position mi.Chapters i. Position;
mc.ThumbnailSource mi.Chapters i. ThumbnailSource;
mc.Title mi.Chapters i. Title;
SLP.Chapters.Add mc ;
finally mi null; mc null;
ADDITIONAL RESOURCES
Media Player Silverlight Media Player Silverlight SilverLight Microsoft Silverlight Silverlight Player Silverlight Media Player Video Player Audio Player ASP.NET XAML WPF XML RIA C AJAX HTML 5 CSS
3 jQuery Web TV Interactive Web TV Internet TV Web Broadcasting Internet Broadcasting Studio iPhone TV Apple TV Google TV.