Class

MobileMoviePlayer


Description

A control for playing videos in many standard video formats such as mp4, mov, m4v, 3gp, avi, and others.

Property descriptions


MobileMoviePlayer.AccessibilityHint

AccessibilityHint As String

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

Me.AccessibilityHint = "Click to calculate the value and display the next screen."

MobileMoviePlayer.AccessibilityLabel

AccessibilityLabel As String

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

Me.AccessibilityLabel = "Calculate the value."

MobileMoviePlayer.ControlCount

ControlCount As Integer

The number of child controls in the control.

This property is read-only.


MobileMoviePlayer.Duration

Duration As Double

The duration (length) of the movie in seconds.

This property is read-only.

Var d As Double
d = MoviePlayer1.Duration

MobileMoviePlayer.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileMoviePlayer.HasController

HasController As Boolean

Determines if the controller is displayed.

The default is True.


MobileMoviePlayer.Height

Height As Double

The height of the control.

This property is read-only.


MobileMoviePlayer.Left

Left As Double

The left position of the control.

This property is read-only.


MobileMoviePlayer.Movie

Movie As Movie

The movie that will play.

Movies can be imported into a project and then assigned to the MoviePlayer in the Inspector or of course loaded at runtime.


MobileMoviePlayer.Name

Name As String

The name of the control.


MobileMoviePlayer.Parent

Parent As MobileUIControl

The parent (sometimes called a "Super") class of the control.

This property is read-only.


MobileMoviePlayer.Position

Position As Double

The play position of the movie in seconds.

This property is set when the PositionChanged event is called.

Set the movie play position to halfway point:

Var halfway As Double = MoviePlayer1.Duration / 2
MoviePlayer1.Position = halfway

MobileMoviePlayer.TintColor

TintColor As ColorGroup

Changes a control's tint color.

On iOS, the following controls support TintColor:

Enum

Description

ProgressBar

The area indicating the value of the control will be drawn in the TintColor.

Slider

The area indicating the value of the control will be drawn in the TintColor.

TextArea

The cursor and text highlight color will be drawn in the TintColor.

TextField

The cursor and text highlight color will be drawn in the TintColor.


MobileMoviePlayer.Top

Top As Double

The top position of the control.

This property is read-only.


MobileMoviePlayer.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileMoviePlayer.Volume

Volume As Integer

Gets or sets the movie's volume. The range is from 0 to 100.

This example sets the volume to a very low level.

MoviePlayer1.Volume = 10

MobileMoviePlayer.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


MobileMoviePlayer.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

Adds a constraint to the control.

This constraint is used by child controls that have been added to this control.


MobileMoviePlayer.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.


MobileMoviePlayer.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileMoviePlayer.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.


MobileMoviePlayer.Controls

Controls As Iterable

Allows you to iterate through all the controls that have been added to this control.


MobileMoviePlayer.GoToStart

GoToStart

Repositions the playhead at the beginning of the video.

This also sets the Position property to 0.

This example reset the movie back to the start:

MoviePlayer1.GoToStart

MobileMoviePlayer.Handle

Handle As Ptr

The a handle to the underlying native OS control.


MobileMoviePlayer.LoadFile

LoadFile(videoFile As FolderItem)

Loads the video file passed into the MoviePlayer.


MobileMoviePlayer.LoadURL

LoadURL(url As String)

Loads the video at the URL passed into the MoviePlayer.

Load a movie from a URL:

MoviePlayer1.LoadURL("https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4")

MobileMoviePlayer.Pause

Pause

Pauses playback of the movie.

Playback can be resumed by calling the Play method.

Pause the playback of the movie in the MoviePlayer1 control:

MoviePlayer1.Pause

MobileMoviePlayer.Play

Play

Begins or resumes playback of the movie.

Playback can be paused/stopped by calling the Pause method.

Play the movie in the MoviePlayer1 control:

MoviePlayer1.Play

MobileMoviePlayer.Refresh

Refresh

Marks the control so that it will be redrawn during the next event loop.

Call Refresh to force a Canvas to redraw itself:

Canvas1.Refresh

MobileMoviePlayer.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


MobileMoviePlayer.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.


MobileMoviePlayer.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Event descriptions


MobileMoviePlayer.Closing

Closing

Called when the control's layout is closing.


MobileMoviePlayer.Opening

Opening

Called when the control's layout is opening.

This is where you typically put initialization code.

This example in the Opening event of a label sets its text to "Hello":

Me.Text = "Hello"

MobileMoviePlayer.PlaybackPaused

PlaybackPaused

The video playback has paused.

Video playback will pause either because the user called the Pause method or the user clicked the Pause button in the MoviePlayer controller.


MobileMoviePlayer.PlaybackStarted

PlaybackStarted

The video playback has started.

Video playback will start either because the user called the Play method or the user clicked the Play button in the MoviePlayer controller.


MobileMoviePlayer.PositionChanged

PositionChanged

Called when the movie play position has changed.

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileUIControl parent class; FolderItem and Movie classes.