From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from DesktopUIControl)

New in 2021r3

Displays a control for playing movies.

Closing FocusLost MouseMove
ConstructContextualMenu FocusReceived MouseUp
ContextualMenuItemSelected KeyDown MouseWheel
ControllerSizeChanged KeyUp MovieStarted
DragEnter MouseDown MovieStopped
DragExit MouseDrag Opening
DragOver MouseEnter
DropObject MouseExit
Active fa-lock-32.png HasVolumeControl PlayerType
AllowAutoDeactivate Height Position
AllowTabStop Index fa-lock-32.png RepeatInReverse
AutoAdjustToMovieSize Left Scope fa-lock-32.png
AutoPlay LockBottom TabIndex
AutoRepeat LockLeft Tooltip
ControllerHeight fa-lock-32.png LockRight Top
ControllerWidth fa-lock-32.png LockTop Transparent
Duration fa-lock-32.png MouseCursor Visible
Enabled Movie Volume
Handle fa-lock-32.png Name fa-lock-32.png Width
HasBorder fa-lock-32.png OLEMovieObject fa-lock-32.png Window fa-lock-32.png
HasController PanelIndex
HasStepControls Parent
AcceptFileDrop Close SetFocus
AcceptPictureDrop DrawInto Stop
AcceptRawDataDrop Play
AcceptTextDrop Refresh


Windows uses the Windows Movie Player to play movies and macOS uses AVFoundation. On Linux, the MoviePlayer uses GStreamer by default (it requires version 0,10+) and uses Xine if GStreamer is not available.

The HasController property dictates if the movie controls (if any) will be displayed. Passing False means that there will be no user controls available. Passing True means that the regular movie controls will be available.

Because movie loading is asynchronous, you should not have AutoAdjustToMovieSize = True if you are also manually modifying the Width and Height as it is possible that the auto resizing will occur after you have changed the size.

Windows Resizing

Movies do not automatically resize to fill the screen on Windows. You can alter this behavior with this code:

Var obj As OLEObject = MoviePlayer1.MovieController
obj.Value("stretchToFit") = True

Sample Code

This code sets the movie "myHomeMovie" as the movie to be played.

MoviePlayer1.Movie = myHomeMovie

This code loads a movie called "MyMovie" from the current folder into MoviePlayer1 and plays it.

Var f As FolderItem
f = FolderItem.ShowOpenFileDialog("MyMovie")
MoviePlayer1.HasVolumeControl = True
MoviePlayer1.HasStepControls = False
MoviePlayer1.Movie = Movie.Open(f)

If you added the movie to your project, you can assign it to the movie property with only one line of code:

MoviePlayer1.Movie = MyMovie

The following code uses the MovieController property to get the current position of the player:

Var pos As Double
pos = MoviePlayer1.MovieController.Controls.CurrentPosition

See Also

Movie.OpenURL function; Movie, WebMoviePlayer classes.