How to use the shaka-player.polyfill function in shaka-player

To help you get started, we’ve selected a few shaka-player examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bytedance / xgplayer / packages / xgplayer-shaka / src / index.js View on Github external
constructor (options) {
    super(options)
    let self = this
    this.shakaOpts = options.shakaOpts || {}
    this.util = Player.util
    this.player = this
    this.url = this.player.config.url
    this.sniffer = Player.sniffer
    this.player_ = null
    this.content = []

    Shaka.polyfill.installAll()

    if (Shaka.Player.isBrowserSupported()) {
      this.video_ = this.player.video
      this.video_.autoplay = false
      this.player_ = new Shaka.Player(this.video_)

      this.player_.addEventListener('error', function (event) {
        console.error('Error code', event.detail.code, 'object', event.detail) // eslint-disable-line no-console
      })

      if (this.shakaOpts) {
        this.player_.configure(this.shakaOpts)
      }

      this.player_.getNetworkingEngine().registerRequestFilter(function (type, request) {
        // Only add headers to license requests:
github googlearchive / vrview / src / embed / adaptive-player.js View on Github external
AdaptivePlayer.prototype.loadShakaVideo_ = function(url) {
  // Install built-in polyfills to patch browser incompatibilities.
  shaka.polyfill.installAll();

  if (!shaka.Player.isBrowserSupported()) {
    console.error('Shaka is not supported on this browser.');
    return;
  }

  this.initShaka_();
  return this.player.load(url);
};
github raskri / react-shaka-player / src / components / player / Player.js View on Github external
componentDidMount() {
    // Install built-in polyfills to patch browser incompatibilities.
    shaka.polyfill.installAll();

    // Check to see if the browser supports the basic APIs Shaka needs.
    if (shaka.Player.isBrowserSupported()) {
      // Everything looks good!
      this.initPlayer();
    } else {
      // This browser does not have the minimum set of APIs we need.
      console.error('Browser not supported!');
    }
  }
github enactjs / samples / pattern-shaka-video-player / src / components / ShakaVideoPlayer.js View on Github external
componentDidMount () {
			// Install built-in polyfills to patch browser incompatibilities.
			shaka.polyfill.installAll();

			// Check to see if the browser supports the basic APIs Shaka needs.
			if (shaka.Player.isBrowserSupported()) {
				// Everything looks good!
				this.initPlayer();
			} else {
				// This browser does not have the minimum set of APIs we need.
				console.error('Browser not supported!');
			}
		}
github clappr / dash-shaka-playback / src / clappr-dash-shaka-playback.js View on Github external
static canPlay (resource, mimeType = '') {
    shaka.polyfill.installAll()
    let browserSupported = shaka.Player.isBrowserSupported()
    let resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []
    return browserSupported && ((resourceParts[1] === 'mpd') || mimeType.indexOf('application/dash+xml') > -1)
  }
github clappr / dash-shaka-playback / index.js View on Github external
DashShakaPlayback.canPlay = (resource, mimeType = '') => {
  shaka.polyfill.installAll()
  var browserSupported = shaka.Player.isBrowserSupported()

  var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []
  return browserSupported && (('mpd' === resourceParts[1]) || mimeType.indexOf('application/dash+xml') > -1)
}
github matvp91 / indigo-player / src / media / DashMedia / DashMedia.ts View on Github external
constructor(instance: IInstance) {
    super(instance);

    shaka.polyfill.installAll();
  }
github react-native-community / react-native-video / dom / RCTVideo.js View on Github external
constructor(bridge: RCTBridge) {
    super(bridge);

    this.eventDispatcher = bridge.getModuleByName("EventDispatcher");

    shaka.polyfill.installAll();

    this.onEnd = this.onEnd.bind(this);
    this.onLoad = this.onLoad.bind(this);
    this.onLoadStart = this.onLoadStart.bind(this);
    this.onPlay = this.onPlay.bind(this);
    this.onProgress = this.onProgress.bind(this);

    this.videoElement = this.initializeVideoElement();
    this.videoElement.addEventListener("ended", this.onEnd);
    this.videoElement.addEventListener("loadeddata", this.onLoad);
    this.videoElement.addEventListener("canplay", this.onReadyForDisplay);
    this.videoElement.addEventListener("loadstart", this.onLoadStart);
    this.videoElement.addEventListener("pause", this.onPause);
    this.videoElement.addEventListener("play", this.onPlay);
    this.player = new shaka.Player(this.videoElement);
github vimond / replay / src / replay / components / player / VideoStreamer / ShakaVideoStreamer / shakaSetup.js View on Github external
export function shakaSetup(
  videoElement: HTMLVideoElement,
  configuration: ?ShakaVideoStreamerConfiguration
): ShakaPlayer {
  if (!!window.MediaSource && !!MediaSource.isTypeSupported) {
    const shakaPlayerConfig = configuration && configuration.shakaPlayer;
    if (shakaPlayerConfig && shakaPlayerConfig.installPolyfills) {
      shaka.polyfill.installAll();
    }
    const shakaPlayer = new shaka.Player(videoElement);
    if (shakaPlayerConfig && shakaPlayerConfig.customConfiguration) {
      shakaPlayer.configure(shakaPlayerConfig.customConfiguration);
    }
    return shakaPlayer;
  } else {
    throw new PlaybackError(
      'STREAM_ERROR_TECHNOLOGY_UNSUPPORTED',
      'shaka',
      'MPEG-DASH playback with Shaka Player is not supported in this browser.'
    );
  }
}

shaka-player

DASH/EME video player library

Apache-2.0
Latest version published 4 days ago

Package Health Score

98 / 100
Full package analysis