Video Player Component - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Video Player Component

Insert a video player in a Standard Maple worksheet or document.

 

Description

Notes

Component Palette Image

VideoPlayer Properties

Video Player Component Example

Description

• 

The video player component can play video or audio files. The component performs an action or a series of actions to communicate with other embedded components when the player reaches specified intervals during playback, although assigning an action to a component is not required.

• 

You can insert this embedded component from the Components palette.

• 

There are three methods for specifying the location of the video (or audio) file:

A. 

Using a file stored locally on your computer

B. 

Providing the address of a file located on the internet

C. 

Packaging the file within the Maple worksheet

 

A. 

To reference a file stored locally on your computer: 

1. 

Click the video player component to open the context panel.

2. 

Click Browse next to the Video File Location text box.

3. 

Browse to the location of the file, select the file, and then click Open.

A. 

To reference a file located on the internet: 

1. 

Click the video player component to display the context panel.

2. 

Enter the address of the file in the Video File Location text box.

 

A. 

To package the video file within the MW file:

1. 

Click the video player component, and then select Component Properties.

2. 

Enter the location of the file in the Video File Location text box (this can either be an address on the internet or the path to a file on your computer).

3. 

From the File menu, select Save.

The File Save dialog opens, asking if you want to store the video content inside your worksheet.

Note: Storing the video content inside the worksheet results in a much larger worksheet file size.

4. 

Click Yes.

5. 

If the Save As dialog opens, browse to a location to save the file, enter a file name, and then click Save.

• 

To perform an action when the video player reaches a certain point during playback:

1. 

If you have not already done so, specify the location of a valid video file for the video player component.

2. 

Place your mouse pointer over the video component timeline.

The action editor window appears over the timeline. The action editor window holds markers at certain points in the timeline. When the video reaches a marker, the actions associated with the marker are triggered.

3. 

Place your mouse pointer over the action editor window, and then click on the action editor window.

A marker appears at the point you clicked. If you want to place the marker at a different point in the timeline, you can use your mouse to drag the marker to the desired time.

 

Notes:

• 

To see the time at which the actions for a marker are triggered, place your mouse over the marker. A tooltip with the time appears after a short pause.

• 

The action editor window automatically hides itself when you remove the pointer. To have the action editor window remain visible, click the sticky button ( ).

4. 

Right-click (Control-click for Mac) the marker, and then select Edit Action to open the Code Editor dialog for the marker.

Enter the commands you want to perform in the Code Editor dialog. For more information, see the Video Player Component Example on this page.

• 

The video player component is customized by setting options in the Video Player control panel. To display VideoPlayer Properties, click the video component. Actions are associated with components using routines in the DocumentTools package.

• 

The Name property is used to reference the video component when using the routines from the DocumentTools package.

Notes

• 

The video player component supports MP4 files.  There is limited support for FLV and MP3 file formats, though these have not been fully tested by Maplesoft.  A list of video play file formats and associated codecs can be found here: https://docs.oracle.com/javafx/2/api/javafx/scene/media/package-summary.html#SupportedMediaTypes.

• 

If your Video Play component is in a worksheet and the worksheet is part of a workbook, then to play any supported video file attached to the workbook:

1. 

Open the context panel to display the Video Player component properties;

2. 

Context click on the video file in the workbook navigator,

3. 

Select Copy Path. This will copy the URI of the video file to the clipboard.

4. 

 Paste the URI into the Video File Location field in the context panel.

5. 

Click the play button on the Video Player.

Component Palette Image

VideoPlayer Properties

• 

The following table describes the control and use of the video player component options.

  

An x in the Get column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.

  

An x in the Set column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.

  

 

Option

Get

Set

Option Type

file

x

x

string

loop

x

x

string

position

 

x

string

state

x

x

string

type

x

 

string

  

 

  

file

  

The file path to the video file to display. Can also be an http:// URL to the video file.

  

loop

  

Indicates if the video will loop and play continuously or stop when it reaches the end. If set to "true", the video loops continuously. If set to "false", looping is turned off.

  

position

  

Set the current position of the video file. A string of the form "mm:ss" is expected, where mm is the minute index and ss is the seconds index.

  

state

  

Indicates the state of the video component. Setting this option controls the video playback.

• 

"play" to start the video playing

• 

"stop" to stop the video

• 

"pause" to pause the video

• 

"ended" to set the video to being in a completed state.

• 

"dragging" to indicate that the position is being changed.

  

type 

  

The type of the component. This returns "VideoPlayer".

Video Player Component Example

Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.

This example uses a video player component and a plot component. Two markers are placed in the video player's action editor window. When the video player reaches the first marker, the plot changes from sin to cos; when the second marker is reached, the plot changes from cos to sin.

To insert the components, configure the plot component, and specify the location of the video file:

1. 

Insert a Video Player and a Plot component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.

2. 

Click the Plot component to display the context panel.

3. 

In the Plot Expression field, enter plot(sin).

4. 

Click the Video component to display the context panel.

5. 

Enter the location of the file in the Video File Location text box.

If you do not have a video file, enter the following:

MAPLEDIR\data\videos\world.mp4

Where MAPLEDIR is the installation directory for Maple and can be found by running the kernelopts(mapledir) command in Maple.

 

To place the markers in the action editor window and perform the action of changing the plot  when the markers are reached:

1. 

Place your mouse pointer over the video player component timeline.

The action editor window appears over the timeline. The action editor window holds markers at certain points in the timeline. When the video reaches a marker, the actions associated with the marker are triggered.

2. 

Place your mouse pointer over the action editor window, and then click on the action editor window.

A marker appears at the point you clicked. If you want to place the marker at a different point in the timeline, you can use your mouse to drag the marker to the desired point.

3. 

Right-click (Control-click for Mac) the marker, and then select Edit Action.

This launches a dialog with preset statements and additional information on how to program actions between embedded components.

4. 

Before the end use; statement in the dialog, enter the following command:

SetProperty("Plot0", value, plot(cos));

5. 

Click  or from the File menu, select Save Code to accept all changes.

6. 

From the File menu, select Close Code Editor.

7. 

Place a second marker in the action editor window by repeating steps 1 and 2.

8. 

Right-click (Control-click for Mac) the second marker, and then select Edit Action.

9. 

Before the end use; statement in the dialog, enter the following command:

SetProperty("Plot0", value, plot(sin));

10. 

From the File menu, select Save Code to accept all changes.

11. 

From the File menu, select Close Code Editor.

Play the video. When the video player reaches the markers, the graph in the plot component changes.

 

See Also

DocumentTools

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents