Please login to access all of the features of the Community Site.

PlayVideo

M v1.0

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 that contains the URL of the video to be played.

Note

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

Properties

PropertyTypeDescription
SourcestringThe URL of the media to be played.
BackgroundColorColorA color to be used behind the media.
TitlestringOverrides any metadata in the media and sets the title text to be displayed.
SubtitlestringOverrides any metadata in the media and sets the subtitle text to be displayed.
ControlsContentViewContains the view tree that should be used to provide UI controls, this replaces the default controls.
OverlayContentViewContains the view tree that will be displayed over top of the media. The default content only shows for audio files and displays the artwork.

Important

Note that watch map integration is not currently supported with the PlayVideo command. If this is needed, you'll have to use the Media Player component instead.  

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>