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


Home : Support : Online Help : Programming : Document Tools : Components : Video Player Component

DocumentTools[Components]

  

VideoPlayer

  

generate XML for a VideoPlayer Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

VideoPlayer( filenm, opts )

Parameters

filenm

-

(optional) string; video filename, as a string

opts

-

(optional) ; one or more keyword options as described below

Options

• 

action : list([And(numeric,nonnegative),string]):= [] ; A list of lists. Each entry is a list containing a nonnegative time position and a string of Maple Notation Action code which will execute when the player reaches that position.

• 

defaultdimensions : truefalse:=true ; Indicates whether the default player dimensions should be used.

• 

height : posint:=400 ; The height in pixels of the component, which is not used if the default dimensions are enabled.

• 

hidecontrols : truefalse:=false ; Indicates whether the player controls are hidden.

• 

identity : {name,string}; The reference name of the component.

• 

loop : truefalse:=false ; Indicates whether the playback stops upon reaching the stopping time, or loops back to the starting time.

• 

showcontrols : truefalse:=true ; Indicates whether the player controls are shown when the mouse pointer hovers over the component.

• 

startindex : nonnegint:=0 ; The starting time, representing seconds.

• 

stopindex : nonnegint:=0 ; The stopping time, representing seconds.

• 

width : posint:=600 ; The width in pixels of the component, which is not used if the default dimensions are enabled.

Description

• 

The VideoPlayer command in the Component Constructors package returns an XML function call which represents a VideoPlayer Component.

• 

The generated XML may be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document may be inserted into the current document using the InsertContent command.

Examples

withDocumentTools:

withDocumentTools:-Components:

withDocumentTools:-Layout:

Executing the VideoPlayer command produces a function call.

SVideoPlayeridentity=VideoPlayer0

S_XML_EC-VideoPlayerid=VideoPlayer0,file=,default-dimensions=true,pixel-width=600,pixel-height=400,loop=false,start-index=0,stop-index=0,hide-controls=false,show-controls=false

(1)

By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.

xmlWorksheetGroupInputTextfieldS:

That XML representation of a worksheet can be inserted directly.

InsertContentxml:

fcatkerneloptsdatadir,/videos/videoplayer.mp4:

VVideoPlayerf,identity=VideoPlayer0,defaultdimensions=false,height=300,hidecontrols,showcontrols:

xmlWorksheetGroupInputTextfieldV:

The previous example's call to the InsertContent command inserted a component with identity "VideoPlayer0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "VideoPlayer0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

The return value of the following call to InsertContent is a table which can be used to reference the substituted identity of the inserted component.

lookupInsertContentxml,output=table

lookuptableVideoPlayer0=VideoPlayer1

(2)

lookupVideoPlayer0

VideoPlayer1

(3)

GetPropertylookupVideoPlayer0,loop

false

(4)

The following two examples make use of action code for a VideoPlayer component to update the content of a TextArea component.

The next example requires the update procedure to be defined in the session for the actions to function.

gcatkerneloptsdatadir,/videos/world.mp4:

WVideoPlayerg,identity=VideoPlayer0,height=133,defaultdimensions=false,action=1.25,update(':-TextArea0',1);,9,update(':-TextArea0',2);:

TTextAreaidentity=TextArea0,width=36,depth=4,wrap,showborders=false:

The action code strings in the VideoComponent represented by W call a procedure update which is defined below.

update := proc(comp, x)
    local text := "";
    if x = 1 then
        text := "Maple: The Essential Tool for Mathematics and Modeling";
    elif x = 2 then
        text := "The result of over 30 years of cutting-edge research and development, Maple combines the world's most powerful mathematical computation engine with an intuitive, clickable user interface.";
    end if;
    DocumentTools:-SetProperty(comp, value, text );
end proc:

xmlWorksheetGroupInputTextfieldW,GroupInputTextfieldT:

Now we insert the components. When played the action code will execute when the play reaches the designated positions.

InsertContentxml:

Note that when the mouse cursor hovers over the progress bar of the VideoPlayer Component the action markers are revealed. The action code can be inspected, edited, or removed as a right-click menu choice of the action markers in the progress bar.

The next example uses action code which is self-contained, and unlike the previous example does not require a procedure defined in the session.

gcatkerneloptsdatadir,/videos/world.mp4:

message1Maple: The Essential Tool for Mathematics and Modeling:message2The result of over 30 years of cutting-edge research and development, Maple combines the world's most powerful mathematical computation engine with an intuitive, clickable user interface.:

actionstring1sprintfDocumentTools:-SetProperty('%a', value, %a);,TextArea1,message1:

actionstring2sprintfDocumentTools:-SetProperty('%a', value, %a);,TextArea1,message2:

WVideoPlayerg,identity=VideoPlayer0,height=133,defaultdimensions=false,action=1.25,actionstring1,9,actionstring2:TTextAreaidentity=TextArea1,width=36,depth=4,wrap,showborders=false:

xmlWorksheetGroupInputTextfieldW,GroupInputTextfieldT:InsertContentxml:

Compatibility

• 

The DocumentTools[Components][VideoPlayer] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

See Also

Component Code

Component Constructors

DocumentTools

Embedded Components

XMLTools