Skip to end of metadata
Go to start of metadata

Remarks

VideoPlayer is a full-featured video player control with advanced media playback features supporting all media types in Silverlight. It supports two playback mode, real-time buffering or full download.

  • Buffering Mode
    In buffering mode, the video is streaming directly when played for the first time. There is no restriction in this mode, you are free to set the source to any external or internal URIs.
  • Pre-download
    In pre-download mode, the video will be downloaded completely before it can be played. A progress bar is shown to indicate the download progress in real-time. When the download completes, the control will play the video immediately, unless the video state is stopped or paused.

    Note that in pre-download mode you need to set security access to the designated source since it uses WebClient class from Silverlight core runtime.

Specifying Video Source

Video source is a string formatted URI that points to the target source. You can use relative path or absolute path for the value, but it needs to be in string representation.

XAML

Definition

public class VideoPlayer : ISControl

Summary

The following table summarizes the members exposed in this class.

Public Constructors

VideoPlayer Constructor()Initializes a new instance of the StylishLabel class.

Public Properties

AutoPlayGets or sets a value that determine whether the video should automatically play when video source is changed.
BufferingTimeGets or sets the amount of time to buffer.
DownloadModeGets or sets the video download mode.
IsVideoFullScreenGets a value that indicates whether video is in full screen mode.
MediaElementGets the media element.
MediaElementVisibilityGets or sets the media element visibility.
MediaPlayerContainerElementGets the media player container element.
RootElementGets the root element.
VideoSourceGets or sets the video source.

Protected Properties

ProductProduct Info.

Fields

AutoPlayPropertyIdentifies the VideoSource dependency property.
BufferingTimePropertyIdentifies the BufferingTime dependency property.
DownloadModePropertyIdentifies the DownloadMode dependency property.
ExitFullScreenEventIdentifies the ExitFullScreen routed event.
FullScreenEventIdentifies the FullScreen routed event.
MediaElementVisibilityPropertyIdentifies the MediaElementVisibility dependency property.
PausedEventIdentifies the Paused routed event.
PlayedEventIdentifies the Played routed event.
StoppedEventIdentifies the Stopped routed event.
VideoSourcePropertyIdentifies the VideoSource dependency property.

Public Methods

AttachEventHandlers()Attach built-in event handlers to control templates. Call this method if necessary.
DetachedEventHandlers()Detach built-in event handlers from control templates. Call this method if necessary.
GetVideoSource()Get the video source URI.
InitializeTemplates()Initializes control templates.
OnApplyTemplate()Builds the visual tree for the VideoPlayer when a new template is applied.
Pause()Pause the media element.
Play()Play the media element.
RefreshUIElement()Refresh the entire ui element using the latest configuration.
SetVolume(double)Set the media element sound volume.
Stop()Stop the media element.

Protected Methods

OnExitFullScreen()Raises the ExitFullScreen event.
OnFullScreen()Raises the FullScreen event.
OnMouseMove(MouseEventArgs)Called before the MouseMove event occurs.
OnPaused()Raises the Paused event.
OnPlayed()Raises the Played event.
OnStopped()Raises the Stopped event.

Events

ExitFullScreenOccurs when exiting the full screen.
FullScreenOccurs when full screen.
PausedOccurs when video is paused.
PlayedOccurs when video is played.
StoppedOccurs when video is stopped.

Public Constructors

public VideoPlayer()

Initializes a new instance of the StylishLabel class.

Public Properties

public bool AutoPlay { get; set; }

Gets or sets a value that determine whether the video should automatically play when video source is changed.

public int BufferingTime { get; set; }

Gets or sets the amount of time to buffer.

public DownloadMode DownloadMode { get; set; }

Gets or sets the video download mode.

public bool IsVideoFullScreen { get; }

Gets a value that indicates whether video is in full screen mode.

public MediaElement MediaElement { get; }

Gets the media element.

public Visibility MediaElementVisibility { get; set; }

Gets or sets the media element visibility.

public Grid MediaPlayerContainerElement { get; set; }

Gets the media player container element.

public Grid RootElement { get; }

Gets the root element.

public string VideoSource { get; set; }

Gets or sets the video source.

Protected Properties

protected ProductInfo Product { get; }

Product Info.

Fields

public static readonly DependencyProperty AutoPlayProperty

Identifies the VideoSource dependency property.

public static readonly DependencyProperty BufferingTimeProperty

Identifies the BufferingTime dependency property.

public static readonly DependencyProperty DownloadModeProperty

Identifies the DownloadMode dependency property.

public static readonly RoutedEvent ExitFullScreenEvent

Identifies the ExitFullScreen routed event.

public static readonly RoutedEvent FullScreenEvent

Identifies the FullScreen routed event.

public static readonly DependencyProperty MediaElementVisibilityProperty

Identifies the MediaElementVisibility dependency property.

public static readonly RoutedEvent PausedEvent

Identifies the Paused routed event.

public static readonly RoutedEvent PlayedEvent

Identifies the Played routed event.

public static readonly RoutedEvent StoppedEvent

Identifies the Stopped routed event.

public static readonly DependencyProperty VideoSourceProperty

Identifies the VideoSource dependency property.

Public Methods

public void AttachEventHandlers()

Attach built-in event handlers to control templates. Call this method if necessary.

public void DetachedEventHandlers()

Detach built-in event handlers from control templates. Call this method if necessary.

public Uri GetVideoSource()

Get the video source URI.

Return Types

Video source URI.

 

public void InitializeTemplates()

Initializes control templates.

public void OnApplyTemplate()

Builds the visual tree for the VideoPlayer when a new template is applied.

public void Pause()

Pause the media element.

public void Play()

Play the media element.

public void RefreshUIElement()

Refresh the entire ui element using the latest configuration.

public void SetVolume(double volume)

Set the media element sound volume.

Parameters

volumeSound volume

 

public void Stop()

Stop the media element.

Protected Methods

protected void OnExitFullScreen()

Raises the ExitFullScreen event.

protected void OnFullScreen()

Raises the FullScreen event.

protected void OnMouseMove(MouseEventArgs e)

Called before the MouseMove event occurs.

Parameters

eThe data for the event.

 

protected void OnPaused()

Raises the Paused event.

protected void OnPlayed()

Raises the Played event.

protected void OnStopped()

Raises the Stopped event.

Events

public event ISRoutedEventHandler ExitFullScreen

Occurs when exiting the full screen.

public event ISRoutedEventHandler FullScreen

Occurs when full screen.

public event ISRoutedEventHandler Paused

Occurs when video is paused.

public event ISRoutedEventHandler Played

Occurs when video is played.

public event ISRoutedEventHandler Stopped

Occurs when video is stopped.

  • No labels