Yahoo! Search
Help - Help for Webmasters
« back to results for "how to play .qmx"
Below is a cache of
http://www.movenetworks.com/wp-content/ ... 214_01.pdf. It's a snapshot of the page taken as our search engine crawled the Web. We've highlighted the words: play playing qmx
The web site itself may have changed. You can check the current page (without highlighting) or check for previous versions at the Internet Archive.
Yahoo! is not affiliated with the authors of this page or responsible for its content.
Move Media Player
SDK Documentation
December 14, 2007
Confidential
Page
|
2
Address
796 East Utah Valley Drive
American Fork, UT 84003
General Information
Phone: 801.216.8861
Fax: 801.756.5806
info@movenetworks.com
Sales Information
Phone: 801.216.8828
Fax: 801.756.5806
salesoffice@movenetworks.com
Table of Contents
Table of Contents .................................................................................................................................................... 2
1 Overview ............................................................................................................................................................... 4
2 Player Object Creation and Exposure............................................................................................................ 4
2.1 Code to Create Player.............................................................................................................4
2.2 Code to Play a QVT or QMX................................................................................................5
3 Player Installation and Version Upgrade ..................................................................................................... 6
3.1 QMP Install Library...............................................................................................................6
3.2 Supported Platforms ...............................................................................................................7
3.3 QMP Install APIs ................................................................................................................ 10
4 Player Communication, Manipulation, and Control ................................................................................10
4.1 Player APIs ........................................................................................................................... 10
4.2 Player Events ........................................................................................................................ 13
4.3 Play States ............................................................................................................................. 16
4.4 Player Settings...................................................................................................................... 17
5 Player Related Web Page Enrichment .........................................................................................................18
5.1 My First Player Page Tutorial........................................................................................... 18
6 Quantum Virtual Timelines (QVT)................................................................................................................21
6.1 Introduction to QVT............................................................................................................ 21
6.2 Shows versus Clips versus Gap Clips ............................................................................ 22
6.3 QVT Objects.......................................................................................................................... 22
6.4 Open-ended Timelines ........................................................................................................ 25
6.5 QVT JSON File Format........................................................................................................ 25
6.6 Timestamps and Anchors.................................................................................................... 28
6.7 External Metadata................................................................................................................. 30
December 14, 2007
Confidential
Page
|
3
6.8 Miscellaneous ....................................................................................................................... 32
7 Helper Objects, Methods and Functions, and Debugging.....................................................................32
7.1 Importing/Loading Libraries ............................................................................................ 32
7.2 String Functions................................................................................................................... 33
7.3 Utility Functions ................................................................................................................. 33
7.4 URL Functions..................................................................................................................... 35
7.5 Logging Functionality ....................................................................................................... 36
December 14, 2007
Confidential
Page
|
4
1 Overview
The Move Networks Video Player SDK is a Javascript-based library containing several
different types of functionality, all accessible remotely from a Web server via a Web page.
2 Player Object Creation and Exposure
HTML pages exposing the Move Networks Media Player (QMP) use QVT and related services
to access and manage the player, hiding complexity and increasing the cross platform
compatibility of the page.
In order to a get a player, the page must load the QVT library (
qvt.js
) with the help of the
Move Networks library (
movenetworks.js
).
Include the QVT library by way of
movenetworks.js
with an import of
qvt
:
<script type="text/javascript" charset="utf-8" src="
http://mvnet.xlontech.net/qm/move/stabl ... etworks.js
" import="qvt"></script>
Once loaded, your Web page will have access to the
MN.QVT
and
MN.QVT.QVT
objects, and
thus the player object. Use one of the following APIs to create and expose the player.
2.1 Code to Create Player
Two API options exist for creating a player:
CreatePlayer()
and
EmitObj()
. The only
difference between the two is that
CreatePlayer()
is essentially a wrapper around
EmitObj()
that also attempts to install or upgrade a player prior to calling
EmitObj()
. It is
recommended that
CreatePlayer()
be used in “production” player Web pages, since
CreatePlayer()
attempts to ensure that the player software is available before calling
EmitObj()
.
MN.QVT.CreatePlayer(parentID, callbackFunction, width, height)
This API first attempts to install or upgrade a player. When the installation or upgrade is
complete,
EmitObj()
is called. For example:
<div id="playerParent">The player will go here</div>
...
qmp = MN.QVT.CreatePlayer("playerParent", CallMeBack, 480,
360);
// now use qmp to control the player
qmp.Play("
http://www.foo.com/biff/baz.qvt");
MN.Event.Observe( qmp, "PlayStateChanged",
MyPlayStateChangedFunc );
parentID
: Can be either the parent ID or the parent object.
December 14, 2007
Confidential
Page
|
5
callbackFunction
: Function to be called after the player has been created. The
parameter that will be passed to the
callbackFunction
depends on whether the
player was successfully created or not. If successful, the player object will be passed.
If not successful, a value of
False
will be passed.
width
: (optional) Width of the player in pixels. Defaults to 480.
height
: (optional) Height of the player in pixels. Defaults to 360.
MN.QVT.EmitObj(parentID, width, height)
The
EmitObj()
API is used to create a player instance in the
parentID
element without
checking to see if the player software has been installed. This newly-created player object is
then returned to the code. Caution should be taken when using the
EmitObj()
API because
errors will occur if the player software has not been installed for use with the user’s browser.
For example:
<div id="playerParent">The player will go here</div>
...
qmp = MN.QVT.EmitObj("playerParent", 480, 360);
// now use qmp to control the player
qmp.Play("
http://www.foo.com/biff/baz.qmx");
MN.Event.Observe( qmp, "PlayStateChanged",
MyPlayStateChangedFunc );
Note: In the two examples above, either a normal QVT or a QMX URL can be used in the call
to
Play
; internally, the player converts QMX URLs to a virtual timeline with just a single
piece of content. See the “QVT Objects” section below for more information.
parentID
: Can be either the parent ID or the parent object.
width
: (optional) Width of the player in pixels. Defaults to 480.
height
: (optional) Height of the player in pixels. Defaults to 360.
2.2 Code to Play a QVT or QMX
Play(URL, start=-1, stop=0)
Once a player object is available, you can play content using the
Play()
API.
Play
can be
told to play a .qmx URL, a .qvt URL, a QVT object instance, or a QVT instance as a string. If
null is passed in instead of a URL, the player’s current QVT object is used rather than loading
a new one.
Play()
can also take an optional start and stop position. If -1 is passed as the starting
position, an attempt is made to begin play at the most appropriate location. Omitting the stop
position in a call to
Play
results in playing to the end.
<div id="playerParent">The player will go here</div>
...
qmp = MN.QVT.CreatePlayer("playerParent", CallMeBack, 480,
360);
// now use qmp to control the player
qmp.Play("
http://www.foo.com/biff/baz.qvt", -1);
December 14, 2007
Confidential
Page
|
6
MN.Event.Observe( qmp, "PlayStateChanged",
MyPlayStateChangedFunc );
URL
: Can be a .qmx URL, a .qvt URL, a QVT object instance, or a QVT instance as a
string. If null is passed instead of a URL, the player’s current QVT object is used.
Start
: (optional) Position within the QVT where play should begin. If -1 is
passed, an attempt is made to begin play at the most appropriate location. Defaults to
-1.
Stop
: (optional) Position within the QVT where play should end. Defaults to the
end of the QVT.
Also see the “Creating a Page” tutorial for additional code examples.
3 Player Installation and Version Upgrade
Player installation and upgrade is handled automatically when the
CreatePlayer()
API is
used to instantiate a player. This API uses the QMPInstall library
(
qmpinstall.js
)
to
attempt to install or upgrade the player software from across the Internet. Other methods of
installing or upgrading a player are not available at this time.
3.1 QMP Install Library
The QMPInstall library (
qmpinstall.js
) handles all the work around installing and
upgrading the media player in a user’s browser. This includes the initial installation,
subsequent upgrades, and ongoing status notifications, such as alerting the user of errors
during the installation.
Once a call to create a player has been made using the
CreatePlayer()
API, the page will
go through the four steps listed below.
1.
A platform check will occur, and the user will be informed if the operating system or
browser is not supported.
2.
If the platform is supported but the user has not installed the player, the user will be
guided through the installation process.
3.
If the platform is supported and the player is installed but out of date, the user will be
guided through an upgrade process. If, after the upgrade, a restart of the browser is
needed to load the new player object, the user will be notified.
4.
After initialization, the optional player-loaded
callbackFunction
(see
MN.QVT.CreatePlayer()
above) will be called.
Note: Customization of these steps is not currently supported. For example, the ability to skip
step #3 is not allowed.
The
callbackFunction
must expect a single parameter. That parameter will be set to either
the player object or to a false value. If the callback function is passed a false value, this means
December 14, 2007
Confidential
Page
|
7
that the player was not created successfully. If a non-false value is passed to the callback
function, the player was created successfully and is ready to play content.
In the
callbackFunction
, you might do a check at the beginning of the function like this:
function OnPlayerLoaded(player)
{
if(!player)
// There was a problem creating the player object
return;
// You could put other code here as well
// Otherwise you are good to go
player.Play(someURL);
}
3.2 Supported Platforms
Currently, Move Networks Media Player supports the following platforms and browsers:
Platforms
•
Microsoft Windows 2000/XP/Vista
•
Apple Macintosh OS X or later (both PPC and Intel)
Browsers
•
Microsoft Internet Explorer 5.5 or later
•
Mozilla Firefox 1.5 or later (Windows and Mac)
•
Safari 1.3.2 (build 321.5) or later
The following settings allow the player to determine which platforms and browsers are
allowed to access any media player experience. Simply set each variable to true or false before
the call to create the player.
MN.QMPInstall.allowMozilla
MN.QMPInstall.allowMacPPC
MN.QMPInstall.allowMacIntel
MN.QMPInstall.allowMacSafari
For Example,
MN.QMPInstall.allowMacPPC = false;
would not allow users with a
PowerPC Macintosh to install the player.
Install Messages
The QMPInstall library has a number of messages that it uses during the installation process
to notify the user of the current status of the installation. These messages are displayed in the
container which was passed into the
CreatePlayer()
function. General styling of these
messages can be achieved by styling via CSS. The SDK comes with a default set of styles in
qmpinstall.css
that pages can include if needed.
The installation messages have default values but can be customized to fit a page’s need.
(Please see below for a list of install messages.) To overwrite the values of these messages, set
MN.QMPInstall.MSG_*
. The message values should be overwritten after the page has
December 14, 2007
Confidential
Page
|
8
loaded but before the call to create a player. These values can be set to HTML as well as
JavaScript strings. For example:
<body>
<!—Style the messages that appear during the install
process -->
<div id=”playerContainer” style=”font:bold 12px Tahoma;
color:#4D7CB2;”></div>
………
</body>
function OnPageLoaded()
{
MN.QMPInstall.MSG_CANINSTALL = ‘<p>You do not have the free
player. Click the download button to install it!.</p> \
<p><a href=”#~” onclick=”MN.QMPInstall.StartInstall();”>
<img src=”install_button.jpg” border=”0”> </a></p>’
……..
// Call to create player
}
This code would display the following if the
QMPInstall
library detected that the user
needed to install the player:
The following table includes the installation messages and when they will appear to the user:
Message
Meaning / When Presented
MSG_BADOS
The user is running an unsupported operating system. If
the string
%s
is present in the message, it is replaced with
a list of supported operating systems.
MSG_BADBROWSER
The operating system is supported but the current
browser is not. If the string
%s
is present in the message,
it is replaced with a list of supported browsers for the
operating system.
MSG_NEEDREINSTALL
Used when it is necessary to force the end user to start all
over with the installation process. This will happen
when the client already on the machine doesn't support
the kind of upgrade needed, or the attempted upgrade
didn't work for some reason. This is commonly known as
the "forced upgrade."
December 14, 2007
Confidential
Page
|
9
MSG_NEEDUPGRADE
The user has an old version of the player that must be
upgraded, and the upgrade will be performed
automatically. The message should include an HTML
span with the ID
_qmpUpgradeProgress
to hold the
progress messages. This is used when a new client is
needed before playback can occur. This is commonly
known as the "foreground upgrade."
Note: There is also a “background upgrade” which has
no message associated with it by nature of not bothering
the end user.
MSG_UPGRADING
Displayed repeatedly throughout the upgrade progress.
If the string
%s
is present in the message it is replaced
with the current progress.
MSG_UPGRADEFAILED
An automatic upgrade could not be completed. If the
string
%s
is present in the message, it is replaced with a
reason for the failure if known.
MSG_CANINSTALL
The user does not have the player at all and must install
it. To initiate the installation, the message should
include a link that calls
MN.QMPInstall.StartInstall()
.
MSG_INSTALLING
Displayed once
StartInstall
has been called. If the
string
%s
is present in the message it is replaced with
one of the installation messages below to provide
additional platform-specific instructions.
MSG_INSTALL_java
A Java-based installation is being used; user should be
instructed to trust or allow the Java applet.
MSG_INSTALL_win_ie
The user is on Windows running Internet Explorer and
will be prompted to download and run an executable file
to install the player.
MSG_INSTALL_win_mozilla
The user is on Windows running Firefox and will be
instructed to download and run an executable file to
install the player.
MSG_NEEDRESTART
An upgrade completed, but the new version could not be
loaded. The user needs to restart the browser in order to
complete the upgrade.
December 14, 2007
Confidential
Page
|
10
3.3 QMP Install APIs
CanPlay()
Returns true if the player is installed and up to date. Use this to determine if the user is able to
view content.
InstallRequired()
Returns true if an installation of the player is needed to play content.
UpgradeRequired()
Returns true if an old version of the player is installed but requires an upgrade.
4 Player Communication, Manipulation, and Control
4.1 Player APIs
CurrentBitRate()
Returns the bit rate of the most recently played streamlets, in Kbps.
CurrentClip()
Returns the index in the timeline of the currently playing clip.
CurrentPlayState()
Returns the current state of playback as an integer. Please refer to the “PlayState” section for
more information.
CurrentPosition(position)
Sets the current position in playback. The position can be given in either seconds or a
timestamp string. If called with no arguments, the current position in playback is returned. A
start value of -1 instructs the player to determine where playback should begin. If position
exceeds the duration, playback starts at or near the current end of the timeline. If the position is
less than 0 and not -1, playback starts at the beginning of the timeline.
CurrentQVT()
Returns the current QVT object being played. Call this when the QVT object is needed
temporarily; do not save a reference to the returned object. See section 6.3 for more
information.
Duration()
Returns the duration of the timeline in seconds.
Encrypted()
Returns
true
if any of the content’s sub-streams are encrypted and require a key for playback.
FillColor(color)
Sets the background fill color of the player. Use HTML color strings (for example, #FFFFFF).
GetCurrentURL()
Returns the URL currently being played. If nothing is playing, an empty string is returned.
December 14, 2007
Confidential
Page
|
11
GetSetting(name)
Retrieves a player setting from the operating system’s registry. Returns an empty string if no
value has been set with given name.
HasAudio()
Returns
true
if the content currently playing has an audio stream.
HasVideo()
Returns
true
if the content currently playing has a video stream.
Height(height)
Sets the player’s height. If called with no arguments, the current height of the player is
returned.
InGap()
Returns
true
if the current position is inside a gap. See section 6.2 about gap clips.
Live()
Returns
true
if the current stream is live. A live stream is an open-ended timeline.
Load(URL)
Like
Play
, this method loads the given URL and causes a
TimelineLoaded
event to fire
when loaded. Unlike
Play
, however, playback does not start automatically.
MetadataByIndex(index)
Retrieves the value of the metadata at the given index. Use
MetadataCount
to find the
number of pieces of metadata attached to the current content.
MetadataByName(name)
Retrieves the metadata value associated with the given name. Returns an empty string if there
are no metadata by that name.
MetadataCount()
Returns the number of pieces of public metadata attached to the current content.
MetadataName(index)
Retrieves the name of the metadata at the given index point. Use
MetadataCount
to find the
number of pieces of metadata attached to the current content.
Muted(true or false)
When value is set to
true
, sound is muted during playback. If called with no arguments, the
player’s current muted state is returned.
Paused(true or false)
When value is set to
true
, playback is paused. If called with no arguments, the player’s
current paused state is returned.
Play(URL, start=-1, stop=0)
Start playback of the given URL. URLs should end in a .
qvt
or .
qmx
extension. The start and
stop parameters can be given in either seconds or a timestamp string (for example,
December 14, 2007
Confidential
Page
|
12
05:12:25.123
). The start parameter is optional and defaults to
-1
. A start value of
-1
instructs the player to determine where playback should begin. For live content this is as
close to “live” as possible. For non-live content, this is at the beginning of the content. Any
non-zero start value seeks to that position before playback starts. If a stop value is given,
playback stops at that point.
Note: This method for setting the start time (URL with included start value) is more efficient
than calling
Play
and then setting the
CurrentPosition
.
PlayClip(qmxURL, title=””, start=-1, stop=-1, playStartPos=-1)
Plays a portion of a clip, restricting playback to the specified range. The
title
,
start
,
stop
and
playStartPos
parameters are optional. The
start
and
stop
parameters can be
given in either seconds or a timestamp string.
PutSetting(name, value)
Saves a player setting to the operating system’s registry. Unknown settings are ignored.
Please refer to the
PlayerSettings
section for more information on valid settings.
RealAspectRatio()
Returns the actual video windows aspect ratio of the current content as a number (width
divided by height).
RegistryVersion()
Returns the version of the player currently installed, according to the registry.
Set(variable, value)
Assigns the given value to the given variable. For example:
var myfunc = "qmp.Set('SelectStreams', '0, -1, -1, -1, -1,
-1,-1,-1,-1,-1,-1,-1');";
// assure that the amount of flags is equivalent to the
// profile set in use
myfunc += "qmp.Set('Commit', '1');";
flash.external.ExternalInterface.call("eval", myfunc);
SetAutoPlayNext(value)
When set to true, playback will advance to the next QVT when the current timeline is finished
playing. If not set to false, will default to true and playback of the next QVT will occur
automatically unless a playback stop position was given.
SingleStep()
When video playback is paused, calling this function will advance playback by one video
frame, if possible.
StartTimestamp()
Returns the starting time of the current content in seconds since the epoch (January 1, 1970
GMT). Use this to map content time to actual time. This function can be especially useful for
getting the actual time for live content.
Note: In JavaScript the
Date
object is in milliseconds.
December 14, 2007
Confidential
Page
|
13
Stop()
Stops playback. If nothing is playing, calling this has no effect.
StopScrubbing()
Stops scrubbing.
UserAspectRatio(ratio)
Sets the user-specified aspect ratio. This function is used to force the display to use a different
aspect ratio. Calling with a ratio of 0 tells the player to use the real aspect ratio. If called with
no arguments, the current user-specified aspect ratio is returned.
Version()
Returns the version of the player currently loaded in the browser.
Note: The version and registry version values can be different.
VideoHeight()
Returns the video window height, in pixels, of the content currently playing. Returns zero if
nothing is playing.
VideoWidth()
Returns the video window width, in pixels, of the content currently playing. Returns zero if
nothing is playing.
Volume(level)
Sets the current volume level of the player, from 0 to 100 inclusive. If called with no
arguments, the player’s current volume level is returned.
Width(width)
Sets the player’s width. If called with no arguments, the current width of the player is
returned.
4.2 Player Events
AudioControl(muted, volume)
Fired when the UI needs to be updated to reflect a change in the state of the audio controls. For
example, after setting the Muted or Volume properties, this event will fire with the new values.
The reason this is handled separately is that changes to the audio controls' state may occur
outside the scope of the application (for example, the user clicks the Mute checkbox in the
Wave column of the Windows Volume Control applet).
BitmapReady(status, url)
Fired when
SendBitmapAsync
or
SendBitmap
completes. The resulting status value is 0
on failure and 1 on success with the URL parameter containing the URL of the uploaded file.
BitRateChanged(newRate)
Fired when the playback bit rate changes. The
newRate
parameter is the number of Kbps.
Error(msg)
Fired to pass an error message to the Web page (for example, a bad URL). The parameter is a
human-readable string.
December 14, 2007
Confidential
Page
|
14
MutedChanged(newMuted)
Fired when the player’s muted state changes. The
newMuted
parameter is
true
if the player is
muted.
NextClip(clipNumber)
Fired when the player transitions from one clip to the next in the timeline.
NextTimeline(url)
Fired when the player has finished playing the current timeline and is automatically moving to
the next linked timeline.
NotSustainable(reason)
Fired for the lowest priority stream when any playing stream encounters too many frame drops.
The player cancels the most recent not sustainable event when all streams go a period without
a further frame drop. A reason code is returned.
PausedChanged(newPaused)
Fired when the player’s paused state changes. The
newPaused
parameter is
true
if playback
is paused.
PlayStateChanged(oldPlayState, newPlayState)
Fired when the player transitions to a new play state. Please refer to the “P lay State Values”
section for more information.
Script(key, value)
Fired when the player encounters an embedded script event. The key and value data are
publisher-defined strings.
ScrubBumper(atStart)
Fired when a scrubbing operation has reached the beginning or end of the scrub range. Since
scrubbing is currently only supported within the clip, and not across clips, the scrub range is
the play range of the clip the user was in when they chose to begin scrubbing.
ShowChanged(showNumber, showTitle)
Fired when playback has moved to another item in the playlist.
TimelineLoaded(qvt)
Fired when the playlist for a timeline has finished loading.
VolumeChanged(newVolume)
Fired when the player’s volume has changed. The
newVol
parameter is the current value of the
player’s volume from 0 to 100 inclusive.
Event Handling
The Move Networks SDK includes an event handling library. The event library extends the
browser’s
Event
object to include functions for cross-browser event handling and player
event handling.
To add an event handler to an object, use the following:
December 14, 2007
Confidential
Page
|
15
MN.Event.Observe(object, eventName, listenerFunction)
For example, the following would set up a function to be called every time the player’s bit rate
changed:
function OnBitRateChanged(newRate)
{ // Function names can be anything of course
log(‘The bit rate changed to ‘ + newRate + ‘ Kbps);
}
MN.Event.Observe(playerObject or ID, ‘BitRateChanged’,
OnBitRateChanged);
Note: When using the event library, event names should not include the
On
prefix. (for
example,
onclick
would be passed in as
click
).
To remove an event handler, use
MN.Event.StopObserving(object, eventName,
listenerFunction)
.
For example, the following would stop observing the event that we started observing in the
above example:
MN.Event.StopObserving(playerObject, ‘BitRateChanged’,
OnBitRateChanged)
Note: In order to stop observing an event correctly, the exact same values must be passed into
the
StopObserving
function that were passed into the
Observe
function. If the arguments
don’t match, the event will continue to be observed, and observation of a different event may
be stopped by accident.
In addition to hiding browser-specific details, these event functions also make it possible to
“ stack” multiple listeners for a single event. Stacking allows multiple functions to listen for
the same event being fired by an object. When the object fires the event, all the functions
listening for that object’s event are called.
For example, the following would allow you to have two functions listening for the player’s
PlayStateChanged
event:
MN.Event.Observe(playerObject,‘PlayStateChanged’, UpdateUI)
MN.Event.Observe(playerObject,‘PlayStateChanged’,
OnPlayStateChanged)
When the player fires the
PlayStateChanged
event, both the
UpdateUI
and
OnPlayStateChanged
functions are called.
Note: When stacking event handlers, there is no guarantee as to which order the listening
functions are called.
To ensure that event handlers aren’t accidentally overwritten, it’s generally preferable to use
the above functions for any event handling where multiple handlers might be used. For
December 14, 2007
Confidential
Page
|
16
example, instead of specifying the page load/unload event handlers in the BODY HTML tag
(for example,
<body onload=”…”
), they can be handled by observing the
load
event on the
window object:
MN.Event.Observe(window, “load”, MyLoadFunc)
Please refer to the “Creating My First Page” tutorial to learn more.
MN.Event.Observe(object, eventName, listenerFunction)
Add an event handler to the given object. The object parameter may either be the object or the
object’s ID. The
listenerFunction
is called when the object fires the event.
MN.Event.StopObserving(object, eventName, listenerFunction)
Remove an event handler for the given object. The object parameter may either be the object or
the object’s ID. If no match for the event handler is found for the given object, the call is
ignored.
MN.Event.RemoveAllObservers()
Removes all event handlers registered through
MN.Event.Observe
.
4.3 Play States
The current state of playback can be retrieved by calling the player’s
CurrentPlayState
function. The player’s
PlayStateChanged
event is fired whenever this state changes.
Functions listening for this event will be passed both the old and new play states. The SDK
library provides a play state helper to display the play state as a text string rather than as a
numerical value. This object is referenced using
MN.QMP.PS
. For example:
var state = player.CurrentPlayState();
if (state = = MN.QMP.PS.ERROR)
// do something with the error
$(“playState”).innerHTML = “Current PlayState is “ +
MN.QMP.PS[state];
The strings returned by the play state helper are the names of the states (see table below). It is
important to note that the play states returned by the player and SDK libraries are numbers
and not text strings. The play state helper converts these values into descriptive text strings
that can be displayed to the end user.
When the player is first created, its state is
Init (0)
. Once the player receives the command
to play content, the state switches to
Opening (1).
The progression of the play states
during playback is usually something like:
Opening > Authorizing > Loading > Playing > Media Ended.
The
Waiting
state (255) does not normally need to be handled. If the player is in this state, it
usually means that the publisher is not keeping up with the pace of playback. This happens
when the publisher is late publishing additional content to an open-ended timeline.
Play State
Number
Name
Description
December 14, 2007
Confidential
Page
|
17
0
Init
Initializing and creating player interface
1
Opening
Opening video content
2
Loading
Loading the first streamlets of the content
3 Playing
Playing
content
4
Stopped
Playback of content has stopped as a result of calling
the player Stop function
5
MediaEnded
The end of the current content has been reached
6
Error
An error has occurred with the player
7
Stalled
Playback of content has stalled
8
Authorizing
The player is requesting the server for authorization to
play content
255 Waiting
Content is late being published for open-ended
timelines
4.4 Player Settings
Note: These settings work in the majority of cases. They are present primarily for
testing purposes and should not be changed without prior consultation.
The player has a few user-selectable settings that modify its behavior. See the “P layer APIs”
section for more information on retrieving and modifying setting values.
To change a setting simply call
player.PutSetting(name, value)
. For example:
Player.PutSetting(“Renderer”, “dx”).
To retrieve a setting call
player.GetSetting(name)
.
To change the setting to its default call
PutSetting
with an empty string value, for example
PutSetting(“Renderer”, “”).
Calling
GetSetting()
or any setting other than
RendererDesc
returns that value last
requested, not the one in use. Use the value of
RendererDesc
for information about the
renderer currently in use.
Name
Value
Comments
December 14, 2007
Confidential
Page
|
18
RendererUseOverlays
yes,no
This tells the renderer whether or not to attempt
to use video overlays, if available. This setting is
used only by DirectX renderer.
RendererDesc
(read-only)
Retrieves a text description of the renderer in use.
Renderer
vfw dx
Selects which renderer to attempt to use for
video: dx (DirectX, the default), vfw selects the
older Video For Windows renderer.
AudioRenderer ds
waveout
Selects which audio renderer to attempt to use
for audio:
ds
(DirectSound),
waveout
selects
the WaveOut audio renderer.
5 Player Related Web Page Enrichment
The Move Networks Video Player SDK supports the development of feature-rich player Web
pages. The Web page enrichment features are found in the following files:
autoplayer.js
minimal.js
playerui.js
shinyred.js
validate.js
widget.js
5.1 My First Player Page Tutorial
In order to have enriched pages, one must first have a basic page. This tutorial shows how to
create such a page.
This tutorial covers the basics of putting the Move Play Client into a Web page. The 40 lines
of code for this tutorial can be found below, at the end of section 5.1. This tutorial will
reference that code, giving examples with the corresponding line number(s). If you run into
any problems, see the “Troubleshooting” section below.
First you need to include the URL to the
movenetworks.js
file and import the
qvt.js
library (line
. This
<script>
tag should go into the body of your page.
<script language=”javascript”
src=”
http://www.foo.com/url/to/movenetworks.js”
import=”qvt”></script>
The QVT library aids in embedding the player into your Web page.
December 14, 2007
Confidential
Page
|
19
Next add a script section to the body of your page to put the functionality to create and use the
player (line 12).
<script language=”javascript”>
// Code will go here
</script>
Define a function to be called when the window
load
event is fired, and include a call to
show the logging pane and log a message to it (lines 15–18) Then observe the window load
event passing in this function (line 37).
function OnPageLoaded()
{
MN.Log.ShowPane(500);
log(‘Page
loaded’);
}
MN.Event.Observe(window, ‘load’, OnPageLoaded);
Open the page in a browser. If you see the logging page with your log message in it, you have
successfully loaded the Move Networks Client SDK. Showing the logging pane (line 17) is
not necessary but is a good idea to always have visible during development of a page.
When creating a player, two things are needed to pass in to the
CreatePlayer()
API:
1. An HTML container to put the player object in.
2. A function to be called once the player has been created.
Create a container to hold the player in the body of the page, and give it an ID (line 10).
<div id=”myplayer”></div>
Now define a function to be called once the player has been created (lines 22–35). This
function should check to make sure the value passed to it is not false. If the value is false, this
means that there was an error creating the player. You should also add a global variable to
hold the player object so that it can be referenced when calling other functions (line 13).
var qmp = null; // will hold the reference to the player
object
function OnPlayerLoaded(playerObject)
{
if(!playerObject)
{
logError(‘Failed to create the player’);
return;
}
else
{
// the player was successfully created and you
are good to go
December 14, 2007
Confidential
Page
|
20
qmp
=
playerObject;
qmp.Play(‘
http://qmedia.xlontech.net/100170/streamlets/ \
themagicofflight_on2/output.qmx’); // Play some content
}
}
You are now ready to create the player. To create the player, call
MN.QVT.CreatePlayer(playerID, callbackFunction, width, height)
(line
19). Place this call in the
OnPageLoaded
function that you already set up. The
MN.QVT.CreatePlayer
function takes optional width and height parameters to set the
player’s initial width and height.
MN.QVT.CreatePlayer(“myplayer”, OnPlayerLoaded, 480, 360);
That is it! When you open the page in a browser, you should see video playing. If you don ’t
see video or are having problems, refer to the “Troubleshooting” section below.
Note: Pages that use the Move Networks Client SDK should typically specify a
DOCTYPE
like this (see line 1):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
An example code listing:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
<title>Creating a player</title>
</head>
<body>
<script type="text/javascript" charset="utf-8"
src="
http://qmedia.xlontech.net/100348/qm/la ... etworks.js"
import="qvt"></script>
<div id="mplayer"></div>
<script language="javascript">
var qmp = null;
function OnPageLoaded()
{
MN.Log.ShowPane(500);
log('Page Loaded');
MN.QVT.CreatePlayer("myplayer", OnPlayerLoaded, 480, 360);
}
function OnPlayerLoaded(player)
{
if(!player)
{
logError('Failed to create the player');
return;
}
else
{
// You are good to go
December 14, 2007
Confidential
Page
|
21
qmp = player;
qmp.Play('
http://qmedia.xlontech.net/100170/strea ... offlight_o
n2/output.qmx');
}
}
MN.Event.Observe(window, 'load', OnPageLoaded);
</script>
</body>
</html>
6 Quantum Virtual Timelines (QVT)
QVT provides services which allow one or more content segments to be sequenced as a single
virtual content timeline within a single QVT (stored in a file with the extension .
qvt
). Like
many elements of Web-based software, they are stored on the Web server but consumed by the
Web client.
6.1 Introduction to QVT
When playing a QVT, the player tries to treat the entire timeline as a single piece of content.
This means that when one clip in the timeline finishes, playback moves to the next clip in the
timeline. Only when playback of all clips has finished does the player enter the
MEDIAENDED
playstate.
QVT files are simply text files stored in Javascript Object Notation (JSON) format
(
http://www.json.org/
), which makes them interoperate with different languages as well as
XML, but without the downsides of XML (such as bloat and the relative difficulty of reading
and writing XML).
A JSON string is white-space agnostic and basically has the form of the following line:
{ property1:value1 ... , propertyN:valueN }
where property has the form of a double-quoted string and value can be either a double-quoted
string, a JSON string, or a list of JSON strings enclosed in brackets ( “[ ]”). Only double-
quoted strings are legal in JSON. See
http://ww w.json.org/
for a more formal syntax
specification.
QMP now ships with a built-in JSON verifier to ensure that no harmful code is included in the
QVT. The raw JSON text is evaluated to create a JavaScript object.
QVT files can have links to next and previous timelines. If a QVT has a next-QVT link, when
playback of the current timeline ends, the player can automatically move to the next timeline
(controlled using the
SetAutoPlayNext(true/false)
API). When playback moves to
the new timeline, internally a call to
Play(newQVT, 0)
is made. Note that if playback does
not reach the end of the timeline (because a stop position was requested), then playback will
not automatically move to the next timeline, regardless of whether or not Set
AutoPlayNext
is enabled.
December 14, 2007
Confidential
Page
|
22
6.2 Shows versus Clips versus Gap Clips
A QVT file is made up of a list of URLs that represent the various media clips to play as part of
the timeline. Each clip, however, may be made up of several shows.
For example, the clip itself could cover an entire day's worth of TV programming. Even though
it is a single clip, many shows were played throughout the day, and each show needs its own
metadata.
If a clip covers multiple shows, the per-show metadata can be specified using the
.shows
property in a QVT file (see “QVT File Format” below for more info). Otherwise, the clip
metadata will be treated as if it were show metadata and will be accessible accordingly.
If a clip does not have a URL specified, it is considered a gap or filler space between clips. A
Web page using QVT could choose to skip the gap or allow it to "play" (the video window is
not updated while a gap is playing, so a Web page could display an alternate image during
that time, for example). A gap clip should not have a list of shows, but it can have arbitrary
metadata.
Instead of having shows tied to clips, a top-level show list can be given instead. This list has
the same format as clip-level show lists, but the shows map directly to timeline times
regardless of where clips begin and end. This can be useful in situations where multiple clips
correspond to a single show list (for example, if the Atomizer is set to record all day but is
restarted halfway through).
If a show list is longer than the timeline at the time the QVT is loaded, it is truncated to make it
match the actual timeline duration. Shows that begin beyond the end of the timeline are
ignored, and if a show lasts longer than the timeline it is shortened. If you are using live
content (such that the timeline continues to grow), simply mark your QVT file as reloadable
and over time the list of shows that is included will grow automatically.
6.3 QVT Objects
QVT Javascript objects are created from the contents of a .
qvt
file, a JavaScript string that
mirrors the contents of a .
qvt
file, or from another QVT object. They are separate from player
objects.
A QVT object contains all the information about the contents of a timeline. You can create a
QVT object by either telling the player to play a URL (and then calling
player.CurrentQVT()
) or with
MN.QVT.AcquireQVT(url or str)
.
Because QVT objects may automatically reload themselves, an internal cache of current QVT
objects is maintained to prevent multiple copies of the same QVT from overrunning the server
with update requests. If you obtain direct access to a QVT object via
MN.QVT.AcquireQVT
,
you need to call
MN.QVT.ReleaseQVT(qvt)
when done with it to ensure the cache stays
up to date. Failure to do this won't necessarily cause errors, but if a user views many QVT
objects in a single session, not calling this function could leave a lot of them lying around
even when you're no longer using them.
QVT objects have the following APIs:
ClipToTimeline(clipNum, clipPos)