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.

Important

This property is supported for iOS 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 Integer

The height of the control.

This property is read-only on iOS.


MobileMoviePlayer.Left

Left As Integer

The left position of the control.

This property is read-only on iOS.


MobileMoviePlayer.LockBottom

LockBottom As Boolean

Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning screen.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockBottom = True

MobileMoviePlayer.LockLeft

LockLeft As Boolean

Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning screen.

LockLeft and Locktop default to True when you add a new control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockLeft has no effect unless LockRight is True.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockLeft = True

MobileMoviePlayer.LockRight

LockRight As Boolean

Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning screen.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockRight = True

MobileMoviePlayer.LockTop

LockTop As Boolean

Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning screen.

LockTop and LockLeft default to True when you add a control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockTop has no effect unless LockBottom is True.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockTop = True

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.

Important

This is supported for iOS only.


MobileMoviePlayer.Name

Name As String

The name of the control.

This property is read-only.


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.

Important

This is supported for iOS only.

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 Integer

The top position of the control.

This property is read-only on iOS.


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 Integer

The width of the control.

This property is read-only on iOS.

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.

Important

This is supported for iOS only.


MobileMoviePlayer.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.

Important

This is supported for iOS only.


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.

Important

This is supported for iOS only.


MobileMoviePlayer.Controls

Controls As Iterable

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

Important

This is supported for iOS only.


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 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.

Important

This is supported for iOS only.


MobileMoviePlayer.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.

Important

This is supported for iOS only.


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.

Note

This event is not currently supported for Android.

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileUIControl parent class; FolderItem and Movie classes.