Media Commands

Block commands pertaining to media content.

PlayAudio

Like the PlayVideo command, this initiates a full-screen playback of an audio file. Given that it's audio, there won't be much to see.

The CommandParameter consists of a string which contains the URL of the audio file to be played.

Starting in v2 of the Shell, you can also pass in a PlayAudioParameters object which contains the following properties.

Property

Type

Description

ThumbnailSource

string

The URL that contains the image to displayed as the thumbnail of the media player. This overrides any embedded artwork found in the metadata.

(See PlayVideoParameters for more properties)

Examples

<Button Text="Tap"
Command="{Binding PlayAudio}"
CommandParameter="http://www.noiseaddicts.com/samples_1w72b820/2541.mp3" />
<Button Text="Tap"
Command="{Binding PlayAudio}">
<Button.CommandParameter>
<Rock:PlayAudioParameters
Source="http://www.noiseaddicts.com/samples_1w72b820/2541.mp3"
ThumbnailSource="https://upload.wikimedia.org/wikipedia/commons/c/c5/Big_buck_bunny_poster_big.jpg" />
</Button.CommandParameter>
</Button>

PlayVideo

This command initiates the playing of a video in full-screen. Usually it is better to use the MediaPlayer view instead, but there are times you just want to play a video when the user taps a button.

The CommandParameter consists of a string which contains the URL of the video to be played.

Starting in v2 of the Shell you can also pass a PlayVideoParameters object that lets you customize the look of the media player. It contains the following properties.

Property

Type

Description

Source

string

The URL of the media to be played.

BackgroundColor

Color

A color to be used behind the media.

Title

string

Overrides any metadata in the media and sets the title text to be displayed.

Subtitle

string

Overrides any metadata in the media and sets the subtitle text to be displayed.

ControlsContent

View

Contains the view tree that should be used to provide UI controls, this replaces the default controls.

OverlayContent

View

Contains the view tree that will be displayed over top of the media. The default content only shows for audio files and displays the artwork.

Examples

<Button Text="Tap"
Command="{Binding PlayVideo}"
CommandParameter="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
<Button Text="Tap"
Command="{Binding PlayVideo}">
<Button.CommandParameter>
<Rock:PlayVideoParameters
Source="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
Title="Big Buck Bunny" />
</Button.CommandParameter>
</Button>