JavaScript API - RSATom/wcjs-gs GitHub Wiki

Initialization

const wcjs = require("wcjs-gs");
const player = new wcjs.JsPlayer(eosCallback);
player.parseLaunch("videotestsrc ! appsink name=sink");
player.addAppSinkCallback("sink",
  function(type, ...args) {
    switch(type) {
      case player.AppSinkSetup: {
        const [mediaType, properties] = args;
        break;
      }
      case player.AppSinkNewPreroll: {
        const [sample] = args;
        break;
      }
      case player.AppSinkNewSample: {
        const [sample] = args;
        break;
      }
      case player.AppSinkEos:
        break;
    }
  });
player.setState(player.GST_STATE_PLAYING);

Player

States:

  • GST_STATE_VOID_PENDING
  • GST_STATE_NULL
  • GST_STATE_READY
  • GST_STATE_PAUSED
  • GST_STATE_PLAYING
AppSink event types:
  • AppSinkSetup
  • AppSinkNewPreroll
  • AppSinkNewSample
  • AppSinkEos
AppSinkCallbacks:
  • for AppSinkSetup = function(AppSinkSetup, mediaType, properties)
  • for AppSinkNewPreroll, AppSinkNewSample = function(eventType, sample)
  • for AppSinkEos = function(AppSinkEos)
Methods:
  • parseLaunch(pipelineDescription)
  • addCapsProbe(elementName, padName, function(mediaType, properties))
  • addAppSinkCallback(appSinkName, appSinkCallback)
  • setState(state)

VideoFrame

Read only properties:

  • pixelFormat
  • width
  • height
  • planes: returns Array of planes offsets.
⚠️ **GitHub.com Fallback** ⚠️