MoviePlayer

From Xojo Documentation

Revision as of 18:55, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

Displays a control for playing Quicktime and Windows Media Player movies.


Super Class

RectControl

Because this is a RectControl, see the RectControl for other properties and events that are common to all RectControl objects.


Events

Name Parameters Description
ControllerSizeChanged The size of the controller has changed.

When a movie first starts this event fires and allows you read the ControllerWidth/Height properties and then resize the MoviePlayer and or window to best accommodate that size. The event also fires if the movie changes size "on its own."

Play The current movie is about to begin playing.
Stop The current movie is about to stop playing.


Properties

Name Type Description
AutoPlay
Introduced 2005r1
Boolean If True, the movie will start playing automatically when it is assigned to the Movie property of the control. The default is False.
AutoResize Boolean If True, the MoviePlayer control resizes itself to fit the size of the movie.
Border
Boolean Draws a border around the movie area.
Controller Integer The type of controller the MoviePlayer displays.

It can take on the following values: 0=No movie controls, 1=Badge, 2=Full controller

ControllerHeight
Integer The height of the controller (pixels).
ControllerWidth
Integer The width of the controller (pixels).
Duration
Introduced 2007r4
Double The duration (in seconds) of the currently playing media.

The movie must be playing for this property of hold a value. If no movie is playing, it is set equal to zero.

EditingEnabled Boolean If True, it is possible to edit the movie.

A MoviePlayer's methods for editing a movie are functional when EditingEnabled is True.

HasStep Boolean If True, the controller has forward and reverse arrows to the right of the slider.

When set in code, HasStep takes effect the next time the MoviePlayer is assigned a movie.

Looping Boolean If True, it replays the movie automatically when it reaches the end.
Movie Movie The movie that will be played.
MovieController
Introduced 2006r1
OLEObject Returns an OLEObject that you can use to access the MoviePlayer directly.
Palindrome Boolean If True, it plays the movie in reverse when the movie reaches its end. Looping must be True for Palindrome to work.
PlayerType
Introduced 2005r1
Integer Indicates the type of movie the MoviePlayer will play.

PlayerType can take on the following values: 0 - Preferred player 1 - QuickTime player 2 - Windows Media player On Windows, the preferred player is the Windows Media Player, but if the WMP cannot play the movie, REALbasic will attempt to use the QuickTime player. On Macintosh, PlayerType is ignored, as the only type of player currently supported is QuickTime. If desired, set PlayerType to 2 to prevent REALbasic from trying the QuickTime player. On Linux, the MoviePlayer uses GStreamer by default (requires version 010+) and uses Xine if GStreamer is not available.

PlaySelection Boolean If a selection is made (via SelStart and SelLength) and this property is set to True, only the selection will be played. If False, normal playback will occur.
Position Double The number of seconds from the start of the movie.
QTMovieController Integer Returns a pointer that refers to the MoviePlayer control. Of use to API programmers.
QTVRNode Integer The node that is currently being shown in the controller.
QTVRNodeCount Integer The number of nodes in the MoviePlayer's movie.
QTVRPan Double The pan angle in degrees of MoviePlayer's QTVR movie.
QTVRPanMax Double The maximum pan angle (in degrees) of the MoviePlayer's QTVR movie.
QTVRPanMin Double The minimum pan angle (in degrees) of the MoviePlayer's QTVR movie.
QTVRPanTiltSpeed Integer The speed of tilt motion (angle in degrees) of the MoviePlayer's QTVR movie.
QTVRTilt Double The tilt angle (in degrees) of the MoviePlayer's QTVR movie.
QTVRTiltMax Double The maximum tilt angle (in degrees) of MoviePlayer's QTVR movie.
QTVRTiltMin Double The minimum tilt angle (in degrees) of MoviePlayer's QTVR movie.
QTVRZoom Double The desired vertical field of view for the specified movie.

This value is constrained by the maximum field of view of the movie. Values that lie outside that limit are clipped to the maximum. Pan and tilt angle values are also clipped if, when combined with the current field of view, they would cause an image to lie outside the current constraints.

QTVRZoomMax Double The maximum zoom field of view.
QTVRZoomMin Double The minimum zoom field of view.
QTVRZoomSpeed Integer The rate at which you can zoom.
Rate Double Sets the playback rate.

For example, the following values have these effects: 0 - Paused / stopped 0.5 - Half normal playback rate 1 - Normal playback rate 2 - Double normal playback rate -1- Reverse normal playback rate Since Rate is a Double, other values, including values outside this range, will work.

SelLength Double Gets or sets the length (in seconds) of the selection.
SelStart Double Gets or sets the starting position (in seconds) of the selection.
Speaker Boolean Displays the speaker volume control.

When set in code, Speaker takes effect the next time the MoviePlayer control is assigned a movie.

Volume Integer Gets or sets the movie's volume. The range is from 0 to 256.


Methods

Name Parameters Return Type Description
Clear Clears the movie's current selection.

Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.

Copy Copies the movie's current selection to the Clipboard.

Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.

Cut Cuts the movie's current selection and places it on the Clipboard.

Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.

Paste Pastes the contents of the Clipboard to the Movie's current selection.

Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.

Play Plays the current movie.
QTVRHotSpotCount nodeID As Integer Integer Returns as an Integer, the number of QTVR hot spots in the movie with the node passed in nodeID.
QTVRHotSpotID node As Integer, index as Integer Integer Returns as an Integer, the ID of a specific hot spot based on node number and hot spot index passed as parameters.
QTVRNodeTypeObject node As Integer Boolean Determines whether the current movie has a QTVR object in it.

Returns a Boolean; True if the movie has a QTVR object.

QTVRNodeTypePanorama node as Integer Boolean Determines whether the current movie has a QTVR Panorama in it.

Returns a Boolean; True if the movie has a QTVR Panorama.

QTVRToggleHotSpotNames Toggles whether HotSpot names are shown in the movie controller.
QTVRTriggerHotSpot hotSpotID as Integer Navigates to the specified hot spot in the MoviePlayer's QTVR movie.
Stop Stops the current movie.
Trim Retains the current selection (specified by SelStart and SelLength) and removes all other media.

Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.

Undo Undos the last operation.

This is actually an Undo/Redo toggle. Set the EditingEnabled property to True to enable the user to make a selection using the MoviePlayer's controller. If the movie is not an EditableMovie, no changes can be saved.


Notes

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

The Controller property dictates how the movie controls (if any) will be displayed. Passing 0 (zero) means that there will be no user controls available. Passing 1 means that a movie icon or badge will be displayed in the lower left corner of the movie area instead of the controller. When this badge is clicked by the user, the badge disappears and the regular movie controls appear at the bottom of the movie frame. Passing 2 displays the regular movie controls.


Examples

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

MoviePlayer1.movie=myHomeMovie

This example loads a movie called "MyMovie" from the current directory (folder) into MoviePlayer1 and plays it.

f=GetFolderItem("MyMovie")
MoviePlayer1.Speaker=True
MoviePlayer1.HasStep=False
MoviePlayer1.movie=f.OpenAsMovie
MoviePlayer1.play

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 example uses the MovieController property to get the current position of the player:

Dim pos as Double
pos=MoviePlayer1.MovieController.Controls.CurrentPosition


See Also

OpenURLMovie function; Movie, EditableMovie classes.