MediaPlayer:API:Calls
From Metrixstream
(Difference between revisions)
MetrixAdmin (Talk | contribs) (Created page with "== Getting Started == The media player has several callbacks and functions available to control it as you see fit. This document will go over them all in detail. == Functions =...") |
MetrixAdmin (Talk | contribs) |
||
Line 42: | Line 42: | ||
== metrix_stopMedia == | == metrix_stopMedia == | ||
+ | This function allows you to stop the playback of media. If the media is already stopped, this function will have no affect. | ||
+ | === Parameters === | ||
+ | |||
+ | This function has no parameters. | ||
+ | |||
+ | === Example Usage === | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | |||
+ | getDefaultPlayer().metrix_stopMedia(); | ||
+ | |||
+ | </script> | ||
== metrix_seekMedia == | == metrix_seekMedia == | ||
+ | |||
+ | This function allows you to seek to a specific location within the media. | ||
+ | |||
+ | === Parameters === | ||
+ | |||
+ | ;percentage | ||
+ | :this is a normalized normalized offset between 0 and 1. If the media is 60 seconds long, then 0.5 would represent 30 seconds. | ||
+ | |||
+ | === Example Usage === | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | |||
+ | getDefaultPlayer().metrix_seekMedia(0.5); | ||
+ | |||
+ | </script> | ||
== metrix_isPlaying == | == metrix_isPlaying == |
Revision as of 15:33, 26 March 2011
Contents |
Getting Started
The media player has several callbacks and functions available to control it as you see fit. This document will go over them all in detail.
Functions
All functions must be called via JavaScript on the actual DOM element of the media player. This id is exposed in the getCustomPlayerEmbedCode macro.
All examples below will leverage the getDefaultPlayer() JavaScript.
<script type="text/javascript"> function getPlayer(name) { var isIE = navigator.appName.indexOf("Microsoft") != -1; var player = (isIE) ? window[name] : document[name]; return player; } function getDefaultPlayer() { return getPlayer("mtxPlayer"); } </script>
metrix_playMedia
This function allows you to play the existing media at its current position of it was paused or stopped.
Parameters
This function has no parameters.
Example Usage
<script type="text/javascript"> getDefaultPlayer().metrix_playMedia(); </script>
metrix_stopMedia
This function allows you to stop the playback of media. If the media is already stopped, this function will have no affect.
Parameters
This function has no parameters.
Example Usage
<script type="text/javascript"> getDefaultPlayer().metrix_stopMedia(); </script>
metrix_seekMedia
This function allows you to seek to a specific location within the media.
Parameters
- percentage
- this is a normalized normalized offset between 0 and 1. If the media is 60 seconds long, then 0.5 would represent 30 seconds.
Example Usage
<script type="text/javascript"> getDefaultPlayer().metrix_seekMedia(0.5); </script>
metrix_isPlaying
metrix_muteVolume
metrix_unmuteVolume
metrix_setVolume
metrix_getVolume
metrix_isMuted
metrix_playSound
<script type="text/javascript"> ==