Legacy
The documentation for the Media Player before Rock Mobile version 6 (.NET MAUI).
Inherits from Xamarin.Forms.ContentView
While there are commands that will allow you to start playback of an audio or video file in full-screen mode, usually you want that video embedded on the page. For example, on your message library pages, you might want to display the sermon title, then the video in-line, and then the description of that sermon. This view will allow you to have a video embedded into a page. The video itself can be set to auto-play (use sparingly) or to wait for the user to instruct it to play.
If a video is not set to AutoPlay
then a thumbnail will be displayed. If you specify a ThumbnailSource
for the view, then that image will be used as the thumbnail. Otherwise, the view will attempt to generate a thumbnail by inspecting the stream and using the ThumbnailPosition
property value as the offset into the video to capture a thumbnail. Due to limitations in both iOS and Android, auto-thumbnail generation only works on MP4/M4V files. It will not work on HLS streams (usually having an m3u8
extension).
HLS (.m3u8) streams from the service Resi are not supported on Android due to an issue on their end. If you need support for this, you'll need to utilize another streaming service.
Properties
Property | Type | Description |
Source | string | The URL to be loaded into the video player. Supports MP4 and HLS. |
ThumbnailSource | string | The URL to be loaded as the thumbnail. Overrides any automatic thumbnail generation. |
PlayButtonSource | string | The URL to be loaded as the play button if AutoPlay is |
AutoPlay | bool | If |
InitialAspectRatio | string | The initial aspect ratio to use until the video has loaded and we know the actual aspect ratio. Can be specified as either a |
ThumbnailPosition | double? | The position into the video to use to generate a thumbnail automatically if no ThumbnailSource is specified. Value is specified in seconds. Defaults to 2 |
Title | string | The text to display in the title position of the screen controls. This overrides any data found in the media metadata. |
Subtitle | string | |
OverlayContent | The view tree to display as an overlay on top of the media. Defaults to a standard view that displays album artwork for audio files only. | |
ControlsContent | The view tree to be used as the on-screen controls. Defaults to the standard screen controls you normally see. | |
PlaybackCompletedCommand | The command to be executed when the media plays to the end. | |
PlaybackCompletedCommandParameter | object | The parameter to pass to the PlaybackCompletedCommand. |
WatchMap | Enables the Watch Map feature in the media player that allows saving playback position to the server and resuming a previous session. Defaults to null. |
Watch Map Properties
Property | Type | Description |
SaveChanges | bool | If true then changes to the watch map will be saved to the server if possible. Defaults to true. |
WatchMap | string | A special run length encoded representation of the watch map that was previously saved. Defaults to null. |
InteractionGuid | Guid? | The unique identifier of an existing Interaction to be updated. If the interaction cannot be found or does not match this video then a new interaction will be created. Defaults to null. |
MediaElementGuid | Guid? | The unique identifier of the MediaElement that is being watched. This value is required to save changes. Defaults to null. |
RelatedEntityTypeId | int? | An optional value to store in the interaction's RelatedEntityTypeId property. Defaults to null. |
RelatedEntityId | int? | An optional value to store in the interaction's RelatedEntityId property. Defaults to null. |
Examples
This second example shows how to configure the MediaPlayer to save the watch interaction when watching a media element video.
Closed Captioning
The MediaPlayer doesn't have a way to toggle captions on or off, but iOS users can take advantage of the Closed Captions + SDH option that will show them. This is currently found under Settings > Accessibility > Subtitles & Captioning. Some video hosts like Vimeo can auto-generate captions.
For more information, check out Apple's official documentation:
Last updated