Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

JavaScript API

Sergey Radionov edited this page Jun 14, 2015 · 31 revisions

Table of Contents

Initialization

var wc = require("webchimera.js");
var vlcPlayer = wc.createPlayer();
or
var wc = require("webchimera.js");
var vlcPlayer = wc.createPlayer(["-vvv"]);
or
var wc = require("webchimera.js");
var vlcPlayer = new wc.VlcPlayer();
or
var wc = require("webchimera.js");
var vlcPlayer = new wc.VlcPlayer(["-vvv"]);

VlcPlayer object

Pixel format possible values:

  • RV32:
  • I420:
State possible values:
  • NothingSpecial:
  • Opening:
  • Buffering:
  • Playing:
  • Paused:
  • Stopped:
  • Ended:
  • Error:
Read only properties:
  • playing:
  • length:
  • state: returns current state.
Read/write properties:
  • pixelFormat:
  • position:
  • time:
  • volume:
  • mute:
Methods:
  • play( mrl ):
  • play():
  • pause():
  • togglePause():
  • stop():
  • toggleMute():
Events callbacks read/write properties:
  • onFrameSetup( width, height, pixelFormat ):
  • onFrameReady( videoFrame ):
  • onFrameCleanup:
  • onMediaChanged:
  • onNothingSpecial: vlc is in idle state doing nothing but waiting for a command to be issued.
  • onOpening: vlc is opening an media resource locator (MRL).
  • onBuffering( percents ): vlc is buffering.
  • onPlaying: vlc is playing a media.
  • onPaused: vlc is in paused state.
  • onForward: vlc is fastforwarding through the media (works only when an input supports forward playback).
  • onBackward: vlc is going backwards through the media (works only when an input supports backwards playback).
  • onEncounteredError: vlc has encountered an error and is unable to continue.
  • onEndReached: vlc has reached the end of current playlist.
  • onStopped:
  • onTimeChanged( time ): time has changed. time is in milliseconds.
  • onPositionChanged( position ): media position has changed.
  • onSeekableChanged( seekable ): media seekable flag has changed.
  • onPausableChanged( pausable ): media pausable flag has changed.
  • onLengthChanged( length ):
Subobjects:
  • .playlist: Access playlist properties.

Playlist object

Mode possible values:

  • Normal: play till last item.
  • Loop: infinite repeat all items.
  • Single: play current playlist item and stop.
Read only properties:
  • itemCount: number that returns the amount of items currently in the playlist.
  • isPlaying: a boolean that returns true if the current playlist item is playing and false when it is not playing.
Read/write properties:
  • currentItem: returns current item index.
  • mode: playlist mode.
Methods:
  • add(mrl) -> int: add a playlist item.
  • addWithOptions(mrl, options) -> int: add a playlist item with options.
  • play(): start playing the current playlist item.
  • playItem(i) -> bool: start playing the item whose identifier is i.
  • pause():
  • togglePause(): toggle the pause state for the current playlist item.
  • stop(): stop playing the current playlist item.
  • next(): iterate to the next playlist item.
  • prev(): iterate to the previous playlist item.
  • clear(): empty the current playlist, all items will be deleted from the playlist.
  • removeItem(i) -> bool: remove the item from playlist whose identifier is i.
  • advanceItem(i, count): change item position within playlist.

RV32VideoFrame object

Read only properties:

  • width:
  • height:
  • pixelFormat: = RV32

I420VideoFrame object

Read only properties:

  • width:
  • height:
  • pixelFormat: = I420
  • uOffset:
  • vOffset:
Clone this wiki locally