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
1
<Button Text="Tap"
2
Command="{Binding PlayAudio}"
3
CommandParameter="http://www.noiseaddicts.com/samples_1w72b820/2541.mp3" />
Copied!
1
<Button Text="Tap"
2
Command="{Binding PlayAudio}">
3
<Button.CommandParameter>
4
<Rock:PlayAudioParameters
5
Source="http://www.noiseaddicts.com/samples_1w72b820/2541.mp3"
6
ThumbnailSource="https://upload.wikimedia.org/wikipedia/commons/c/c5/Big_buck_bunny_poster_big.jpg" />
7
</Button.CommandParameter>
8
</Button>
Copied!

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
1
<Button Text="Tap"
2
Command="{Binding PlayVideo}"
3
CommandParameter="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
Copied!
1
<Button Text="Tap"
2
Command="{Binding PlayVideo}">
3
<Button.CommandParameter>
4
<Rock:PlayVideoParameters
5
Source="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
6
Title="Big Buck Bunny" />
7
</Button.CommandParameter>
8
</Button>
Copied!
Last modified 9mo ago
Copy link