UserGuide

Web Movie Player

From Xojo Documentation

The Movie Player plays a video in a Web Page. The video URL can be specified in the Inspector or via code. You can independently specify up to three versions of the same video. You specify the versions by providing separate URLs. The three versions are for:

  • a desktop client
  • a web client that uses Wi-Fi
  • a web client that uses cellular service

This means you can easily specify different encodings and bitrates depending on the type of device and its connection speed. The client app chooses the most appropriate version to present. Normally, you use the Desktop URL for the large-size, high-bandwidth encoding; the WiFi URL for a smaller-size, high-bandwidth encoding for Mobile clients on WiFi service, and a small-size, low-bandwidth encoding for Mobile clients using cellular service.

The Movie Player control uses the browser’s native HTML5 video capabilities.

Two interesting properties can be set in the Inspector. The AllowFullScreen property displays the widget that toggles between full-screen and the size of the control in the app. The AutoPlay property starts the movie automatically when the control is displayed.

Commonly used properties and methods are listed below. Refer to WebMoviePlayer in the Language Reference for the complete list.

Properties

AllowFullScreen

When True, displays a button on the movie to allow the user to have it display using the full screen.

AutoPlay

When True, the movie begins playing when the control is displayed, if the browser's security/privacy settings allow it.

DesktopURL, MobileCellularURL, MobileWiFiURL

Specifies the various movie URLs to use depending on the type of browser and its connection to the Internet.

Duration

The duration (length) of the movie in seconds.

Position

The play position of the movie in seconds.

Volume

The volume level of the movie (0 = muted, 255 = maximum).

Methods

FastForward, FastForwardStop

Used to activate or stop fast forwarding of the movie.

FastRewind, FastRewindStop

Used to activate or stop fast rewinding of the movie.

GoToBeginning, GoToEnding

Jumps to the beginning or ending of the movie.

Mute

Mutes or unmutes the movie sound.

Play

Starts playing the movie.

Reset

Resets the Movie Player control. Call this method after changing any of the movie URLs.

Stop

Stops playing the movie.

Usage

This sets the movie in code:

MoviePlayer1.DesktopURL = "http://www.test.com/mymovie-large.m4v"
MoviePlayer1.MobileWiFiURL = "http://www.test.com/mymovie-medium.m4v"
MoviePlayer1.MobileCellularURL = "http://www.test.com/mymovie-small.m4v"
MoviePlayer1.Reset

The URLs must be actual URLs that would also work in a web browser. They cannot be local file URLs from a FolderItem.

See Also

WebMoviePlayer class; UserGuide:Web UI topic