Difference between revisions of "WebPlugin/en"

From Ace Stream Wiki
Jump to: navigation, search
(Новая страница: «WebPlugin/en»)
 
 
Line 1: Line 1:
WebPlugin/en
+
==Embed tag attributes==
 +
To embed the plugin into a webpage use the following <embed> template:
 +
<tt><embed type="application/x-acestream-plugin" />
 +
<object classid="clsid:79690976-ED6E-403c-BBBA-F8928B5EDE17"></object></tt>
 +
 
 +
===Required elements===
 +
*'''width''': Specifies the width of the plugin.
 +
*'''height''': Specifies the height of the plugin.
 +
 
 +
===Optional elements===
 +
*'''bgcolor''' (string): Specifies the background color of the video player. Default: ''#000000''
 +
*'''fontcolor''' (string): Specifies the font color. Default: ''#FFFFFF''
 +
*'''videobgcolor''' (string): Specifies the background color of the video player when playing video. Default: ''#000000''
 +
*'''fscontrolsenable''' (bool): Specifies whether controls are enabled in the fullscreen. Default: ''true''
 +
*'''nofscontrolsenable''' (bool): Specifies whether controls are enabled. Default: ''false''
 +
*'''loopable ''' (bool): Specifies whether the video loops on end. Default: ''false''
 +
*'''fscontrols''' (string): Specifies the theme for the fullscreen controls. Default: ''default''
 +
*'''nofscontrols''' (string): Specifies the theme for the controls. Default: ''default''
 +
*'''nofscontrolsheight''' (integer): Specifies the height of the toolbar in pixels. Default: ''36''
 +
 
 +
==Javascript API==
 +
Some description
 +
 
 +
===Common read only properties===
 +
*'''version''' (string): plugin's version
 +
*'''auth''' (integer): user access level
 +
*'''info''' (string): info string
 +
*'''status''' (string): status string
 +
*'''error''' (string): error string
 +
*'''state''' (integer): the engine's state (0 - idle, 1 - prebuffering, 2 - downloading, 3 - buffering, 4 - completed, 5 - checking download, 6 - error, 7 - plugin is connecting to the engine, 8 - playlist loading is in progress)
 +
 
 +
===Playlist===
 +
read only properties
 +
*'''playlistCount''' (integer): number of items in the playlist
 +
*'''playlistIsPlaying''' (bool): true if the current playlist item is playing
 +
*'''playlistCurrentItem''' (integer): zero-based index of the current playlist item
 +
 
 +
methods
 +
*'''void playlistAdd(string mrl, string name = "")''': add a playlist item as MRL
 +
*'''void playlistPlay(int position = 0)''': start playing the current playlist item
 +
*'''void playlistPlayItem(int index, intposition = 0, bool stop_current = true)''': start playing the item whose identifier is "index"
 +
*'''void playlistTogglePause()''': toggle the pause state for the current playlist item
 +
*'''void playlistStop(bool fullstop=false)''': stop playing the current playlist item. If fullstop is true then plugin tells engine to stop downloading item.
 +
*'''void playlistNext()''': iterate to the next playlist item
 +
*'''void playlistPrev()''': iterate to the previous playlist item
 +
*'''void playlistClear()''': empty the current playlist, all items will be deleted from the playlist
 +
*'''void playlistRemoveItem(int index)''': remove the item from playlist whose identifier is "index"
 +
*'''string playlistItemTitle(int index)''': get the title of the specified item
 +
*'''string playlistItemInfohash(int index)''': get the infohash of the specified item
 +
*'''int playlistItemState(int index)''': get the state of the specified item (0 - disabled, 1 - enabled)
 +
*'''bool playlistItemIsSaveable(int index)''': check whether the specified item can be saved on the disk
 +
*'''void playlistItemSave(int index)''': save the specified item on the disk (a dialog will be shown to choose destination)
 +
*'''void playlistSetItemState(int index, bool active)''': set item state (enabled/disabled)
 +
*'''void playlistToggleItemState(int index)''': toggle item state
 +
*'''void playlistMoveItem(int indexfrom, int indexto)''': move the item to another position in the playlist
 +
*'''void playlistSelectAll()''': enable all items in the playlist
 +
*'''void playlistSelectNone()''': disable all items in the playlist
 +
*these methods are used to load playlist from the specified source:
 +
**'''string playlistLoad(string torrentUrl, int developerId, int affiliateId, int zoneId)''': load from the torrent specified by ''torrentUrl''
 +
**'''string playlistLoadInfohash(string infohash, int developerId, int affiliateId, int zoneId)''': load by infohash
 +
**'''string playlistLoadPlayer(string contentId)''': load by content id
 +
**'''string playlistLoadRaw(string torrentData, int developerId, int affiliateId, int zoneId)''': load from raw torrent data (the contents of a torrent file encoded as base64)
 +
:each method returns a string containing the list of items in json format
 +
:''developerId'', ''affiliateId'' and ''zoneId'' parameters should be set to ''0'' if you don't known what to do with them
 +
 
 +
*these methods are the same as previous except they are executed asynchronously and return immediatelly:
 +
**'''void playlistLoadAsync(string torrentUrl, int developerId, int affiliateId, int zoneId)'''
 +
**'''void playlistLoadAsyncInfohash(string infohash, int developerId, int affiliateId, int zoneId)'''
 +
**'''void playlistLoadAsyncPlayer(string contentId)'''
 +
**'''void playlistLoadAsyncRaw(string torrentData, int developerId, int affiliateId, int zoneId)'''
 +
 
 +
*'''void playlistLoadUrl(string url, int developerId, int affiliateId, int zoneId, string name, bool clear_playlist = false)''': add an url to the playlist. This url will be used by engine to retrieve the content. ''name'' parameter is used to set the item title in the playlist. If ''clear_playlist'' is true then the playlist will be cleared before the new item is added
 +
 
 +
*'''string playlistGetPlayerId(string infohash, int developerId, int affiliateId, int zoneId)''': get the content id for the given infohash, developer, affiliate and zone ids
 +
 
 +
===Audio===
 +
read only properties
 +
*'''audioCount''' (integer): the number of audio track available
 +
 
 +
read/write properties
 +
*'''audioMute''' (bool): boolean value to mute and unmute the audio
 +
*'''audioVolume''' (interger): a value between 0 and 100 which indicates a percentage of the volume
 +
*'''audioTrack''' (integer): a value between 1 and plugin.audioCount which indicates the audio track to play or that is playing. a value of 0 means the audio is/will be disabled
 +
*'''audioChannel''' (integer): integer value between 1 and 5 that indicates which audio channel mode is used, values can be: "1=stereo", "2=reverse stereo", "3=left", "4=right", "5=dolby". Use plugin.audioChannel to check if setting of the audio channel mode has succeeded
 +
 
 +
methods
 +
*'''void audioToggleMute()''': boolean toggle that mutes and unmutes the audio based upon the previous state
 +
*'''string audioDescription(int i)''': give the i-th audio track name. 0 corresponds to disable and 1 to the first audio track
 +
 
 +
===Input===
 +
read only properties
 +
*'''inputLength''' (integer): length of the input file in number of milliseconds. 0 is returned for 'live' streams or clips whose length cannot be determined by the plugin. It returns -1 if no input is playing.
 +
*'''inputState''' (integer): current state of the input chain given as enumeration (IDLE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7). Note: Test for ENDED=6 to catch end of playback. Checking for STOPPING=5 is NOT ENOUGH.
 +
*'''inputFps''' (float): frames per second returned as a float (typically 60.0, 50.0, 23.976, etc...)
 +
*'''inputHasVout''' (bool): a boolean that returns true when the video is being displayed, it returns false when video is not displayed
 +
*'''inputIsAd''' (bool): true if ad is playing now
 +
*'''inputIsInterruptableAd''' (bool): true if interruptible ad is playing now
 +
*'''inputIsP2P''' (bool): true if current item is played via P2P (not a regular file/stream)
 +
 
 +
read/write properties
 +
*'''inputPosition''' (float): normalized position in multimedia stream item given as a float value between [0.0 - 1.0]
 +
*'''inputTime''' (integer): the absolute position in time given in milliseconds, this property can be used to seek through the stream
 +
*'''inputRate''' (float): input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.)
 +
 
 +
===Subtitles===
 +
read only properties
 +
*'''subtitleCount''' (integer): returns the number of subtitle available
 +
 
 +
read/write properties
 +
*'''subtitleTrack''' (integer): get and set the subtitle track to show on the video screen. The property takes an integer as input value [1..65535]. If subtitle track is set to 0, the subtitles will be disabled. If set to a value outside the current subtitle tracks range, then it will return -1 and display an error message
 +
 
 +
methods
 +
*'''string subtitleDescription(int i)''': give the i-th subtitle name. 0 correspond to disable and 1 to the first subtitle
 +
 
 +
===Video===
 +
read only properties
 +
*'''videoWidth''' (integer): returns the horizontal size of the video
 +
*'''videoHeight''' (integer): returns the vertical size of the video
 +
 
 +
read/write properties
 +
*'''videoFullscreen''' (bool): when set to true the video will be displayed in fullscreen mode, when set to false the video will be shown inside the video output size
 +
*'''videoAspectRatio''' (string): get and set the aspect ratio to use in the video screen. Typical values are: "1:1", "4:3", "16:9", "16:10", "221:100" and "5:4"
 +
*'''videoCrop''' (string): get and set the crop to use in the video screen. Typical values are: "16:9", "16:10", "185:100", "239:100", "5:3", "4:3", "5:4", "1:1"
 +
*'''deinterlaceStatus''' (string): possible values are "off", "auto", "on"
 +
*'''deinterlaceMode''' (string): possible values are "discard", "blend", "mean", "bob", "linear", "x", "yadif", "yadif2x"
 +
 
 +
methods
 +
*'''void videoToggleFullscreen()''': toggle the fullscreen mode based on the previous setting
 +
 
 +
==Examples==
 +
Embedding the plugin into a webpage (for all browsers, except Internet Explorer):
 +
<tt><!DOCTYPE html>
 +
<html>
 +
<head>
 +
    <title>Plugin Test</title>
 +
</head>
 +
<body>
 +
    <embed id="plugin" type="application/x-acestream-plugin"
 +
        width="800"
 +
        height="600"
 +
        fullscreencontrols="true"
 +
        fscontrolsenable="true"
 +
        fscontrols="default"
 +
        nofscontrolsenable="true"
 +
        nofscontrols="default"
 +
        nofscontrolsheight="36"
 +
        loopable="false" />
 +
</body>
 +
</html></tt>
 +
 
 +
Embedding the plugin into a webpage (Internet Explorer):
 +
<tt><!DOCTYPE html>
 +
<html>
 +
<head>
 +
    <title>Plugin Test</title>
 +
</head>
 +
<body>
 +
    <object id="plugin" classid="clsid:79690976-ED6E-403c-BBBA-F8928B5EDE17">
 +
        <param name="width" value="800" />
 +
        <param name="height" value="600" />
 +
        <param name="fullscreencontrols" value="true" />
 +
        <param name="fscontrolsenable" value="true" />
 +
        <param name="fscontrols" value="default" />
 +
        <param name="nofscontrolsenable" value="true" />
 +
        <param name="nofscontrols" value="default" />
 +
        <param name="nofscontrolsheight" value="36" />
 +
        <param name="loopable" value="false" />
 +
    </object>
 +
</body>
 +
</html></tt>
 +
 
 +
Load playlist from the torrent or via content id:
 +
<tt><script type="text/javascript">
 +
var plugin = document.getElementById("plugin");
 +
 +
// load from torrent
 +
plugin.playlistLoadAsync("http://static.torrentstream.org/torrents/sintel.torrent", 0, 0, 0);
 +
 +
// load by the content id
 +
plugin.playlistLoadPlayerAsync("5953213c22c304b4f2aab0029a0915fbadca3f8a");
 +
</script></tt>

Latest revision as of 16:14, 20 December 2012

Embed tag attributes

To embed the plugin into a webpage use the following <embed> template:

<embed type="application/x-acestream-plugin" />
<object classid="clsid:79690976-ED6E-403c-BBBA-F8928B5EDE17"></object>

Required elements

  • width: Specifies the width of the plugin.
  • height: Specifies the height of the plugin.

Optional elements

  • bgcolor (string): Specifies the background color of the video player. Default: #000000
  • fontcolor (string): Specifies the font color. Default: #FFFFFF
  • videobgcolor (string): Specifies the background color of the video player when playing video. Default: #000000
  • fscontrolsenable (bool): Specifies whether controls are enabled in the fullscreen. Default: true
  • nofscontrolsenable (bool): Specifies whether controls are enabled. Default: false
  • loopable (bool): Specifies whether the video loops on end. Default: false
  • fscontrols (string): Specifies the theme for the fullscreen controls. Default: default
  • nofscontrols (string): Specifies the theme for the controls. Default: default
  • nofscontrolsheight (integer): Specifies the height of the toolbar in pixels. Default: 36

Javascript API

Some description

Common read only properties

  • version (string): plugin's version
  • auth (integer): user access level
  • info (string): info string
  • status (string): status string
  • error (string): error string
  • state (integer): the engine's state (0 - idle, 1 - prebuffering, 2 - downloading, 3 - buffering, 4 - completed, 5 - checking download, 6 - error, 7 - plugin is connecting to the engine, 8 - playlist loading is in progress)

Playlist

read only properties

  • playlistCount (integer): number of items in the playlist
  • playlistIsPlaying (bool): true if the current playlist item is playing
  • playlistCurrentItem (integer): zero-based index of the current playlist item

methods

  • void playlistAdd(string mrl, string name = ""): add a playlist item as MRL
  • void playlistPlay(int position = 0): start playing the current playlist item
  • void playlistPlayItem(int index, intposition = 0, bool stop_current = true): start playing the item whose identifier is "index"
  • void playlistTogglePause(): toggle the pause state for the current playlist item
  • void playlistStop(bool fullstop=false): stop playing the current playlist item. If fullstop is true then plugin tells engine to stop downloading item.
  • void playlistNext(): iterate to the next playlist item
  • void playlistPrev(): iterate to the previous playlist item
  • void playlistClear(): empty the current playlist, all items will be deleted from the playlist
  • void playlistRemoveItem(int index): remove the item from playlist whose identifier is "index"
  • string playlistItemTitle(int index): get the title of the specified item
  • string playlistItemInfohash(int index): get the infohash of the specified item
  • int playlistItemState(int index): get the state of the specified item (0 - disabled, 1 - enabled)
  • bool playlistItemIsSaveable(int index): check whether the specified item can be saved on the disk
  • void playlistItemSave(int index): save the specified item on the disk (a dialog will be shown to choose destination)
  • void playlistSetItemState(int index, bool active): set item state (enabled/disabled)
  • void playlistToggleItemState(int index): toggle item state
  • void playlistMoveItem(int indexfrom, int indexto): move the item to another position in the playlist
  • void playlistSelectAll(): enable all items in the playlist
  • void playlistSelectNone(): disable all items in the playlist
  • these methods are used to load playlist from the specified source:
    • string playlistLoad(string torrentUrl, int developerId, int affiliateId, int zoneId): load from the torrent specified by torrentUrl
    • string playlistLoadInfohash(string infohash, int developerId, int affiliateId, int zoneId): load by infohash
    • string playlistLoadPlayer(string contentId): load by content id
    • string playlistLoadRaw(string torrentData, int developerId, int affiliateId, int zoneId): load from raw torrent data (the contents of a torrent file encoded as base64)
each method returns a string containing the list of items in json format
developerId, affiliateId and zoneId parameters should be set to 0 if you don't known what to do with them
  • these methods are the same as previous except they are executed asynchronously and return immediatelly:
    • void playlistLoadAsync(string torrentUrl, int developerId, int affiliateId, int zoneId)
    • void playlistLoadAsyncInfohash(string infohash, int developerId, int affiliateId, int zoneId)
    • void playlistLoadAsyncPlayer(string contentId)
    • void playlistLoadAsyncRaw(string torrentData, int developerId, int affiliateId, int zoneId)
  • void playlistLoadUrl(string url, int developerId, int affiliateId, int zoneId, string name, bool clear_playlist = false): add an url to the playlist. This url will be used by engine to retrieve the content. name parameter is used to set the item title in the playlist. If clear_playlist is true then the playlist will be cleared before the new item is added
  • string playlistGetPlayerId(string infohash, int developerId, int affiliateId, int zoneId): get the content id for the given infohash, developer, affiliate and zone ids

Audio

read only properties

  • audioCount (integer): the number of audio track available

read/write properties

  • audioMute (bool): boolean value to mute and unmute the audio
  • audioVolume (interger): a value between 0 and 100 which indicates a percentage of the volume
  • audioTrack (integer): a value between 1 and plugin.audioCount which indicates the audio track to play or that is playing. a value of 0 means the audio is/will be disabled
  • audioChannel (integer): integer value between 1 and 5 that indicates which audio channel mode is used, values can be: "1=stereo", "2=reverse stereo", "3=left", "4=right", "5=dolby". Use plugin.audioChannel to check if setting of the audio channel mode has succeeded

methods

  • void audioToggleMute(): boolean toggle that mutes and unmutes the audio based upon the previous state
  • string audioDescription(int i): give the i-th audio track name. 0 corresponds to disable and 1 to the first audio track

Input

read only properties

  • inputLength (integer): length of the input file in number of milliseconds. 0 is returned for 'live' streams or clips whose length cannot be determined by the plugin. It returns -1 if no input is playing.
  • inputState (integer): current state of the input chain given as enumeration (IDLE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7). Note: Test for ENDED=6 to catch end of playback. Checking for STOPPING=5 is NOT ENOUGH.
  • inputFps (float): frames per second returned as a float (typically 60.0, 50.0, 23.976, etc...)
  • inputHasVout (bool): a boolean that returns true when the video is being displayed, it returns false when video is not displayed
  • inputIsAd (bool): true if ad is playing now
  • inputIsInterruptableAd (bool): true if interruptible ad is playing now
  • inputIsP2P (bool): true if current item is played via P2P (not a regular file/stream)

read/write properties

  • inputPosition (float): normalized position in multimedia stream item given as a float value between [0.0 - 1.0]
  • inputTime (integer): the absolute position in time given in milliseconds, this property can be used to seek through the stream
  • inputRate (float): input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.)

Subtitles

read only properties

  • subtitleCount (integer): returns the number of subtitle available

read/write properties

  • subtitleTrack (integer): get and set the subtitle track to show on the video screen. The property takes an integer as input value [1..65535]. If subtitle track is set to 0, the subtitles will be disabled. If set to a value outside the current subtitle tracks range, then it will return -1 and display an error message

methods

  • string subtitleDescription(int i): give the i-th subtitle name. 0 correspond to disable and 1 to the first subtitle

Video

read only properties

  • videoWidth (integer): returns the horizontal size of the video
  • videoHeight (integer): returns the vertical size of the video

read/write properties

  • videoFullscreen (bool): when set to true the video will be displayed in fullscreen mode, when set to false the video will be shown inside the video output size
  • videoAspectRatio (string): get and set the aspect ratio to use in the video screen. Typical values are: "1:1", "4:3", "16:9", "16:10", "221:100" and "5:4"
  • videoCrop (string): get and set the crop to use in the video screen. Typical values are: "16:9", "16:10", "185:100", "239:100", "5:3", "4:3", "5:4", "1:1"
  • deinterlaceStatus (string): possible values are "off", "auto", "on"
  • deinterlaceMode (string): possible values are "discard", "blend", "mean", "bob", "linear", "x", "yadif", "yadif2x"

methods

  • void videoToggleFullscreen(): toggle the fullscreen mode based on the previous setting

Examples

Embedding the plugin into a webpage (for all browsers, except Internet Explorer):

<!DOCTYPE html>
<html>
<head>
    <title>Plugin Test</title>
</head>
<body>
    <embed id="plugin" type="application/x-acestream-plugin"
        width="800"
        height="600"
        fullscreencontrols="true"
        fscontrolsenable="true"
        fscontrols="default"
        nofscontrolsenable="true"
        nofscontrols="default"
        nofscontrolsheight="36"
        loopable="false" />
</body>
</html>

Embedding the plugin into a webpage (Internet Explorer):

<!DOCTYPE html>
<html>
<head>
    <title>Plugin Test</title>
</head>
<body>
    <object id="plugin" classid="clsid:79690976-ED6E-403c-BBBA-F8928B5EDE17">
        <param name="width" value="800" />
        <param name="height" value="600" />
        <param name="fullscreencontrols" value="true" />
        <param name="fscontrolsenable" value="true" />
        <param name="fscontrols" value="default" />
        <param name="nofscontrolsenable" value="true" />
        <param name="nofscontrols" value="default" />
        <param name="nofscontrolsheight" value="36" />
        <param name="loopable" value="false" />
    </object>
</body>
</html>

Load playlist from the torrent or via content id:

<script type="text/javascript">
var plugin = document.getElementById("plugin");

// load from torrent
plugin.playlistLoadAsync("http://static.torrentstream.org/torrents/sintel.torrent", 0, 0, 0);

// load by the content id
plugin.playlistLoadPlayerAsync("5953213c22c304b4f2aab0029a0915fbadca3f8a");
</script>