How to use dashjs - 9 common examples

To help you get started, we’ve selected a few dashjs 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 openfun / marsha / src / frontend / Player / createDashPlayer.ts View on Github external
export const createDashPlayer = (
  video: Video,
  videoNode: HTMLVideoElement,
): MediaPlayerClass => {
  const dash = MediaPlayer().create();
  dash.initialize(videoNode, video.urls.manifests.dash, false);
  dash.updateSettings({
    streaming: {
      abr: {
        initialBitrate: {
          video: 1600, // 480p
        },
        maxBitrate: {
          video: 2400, // 720p
        },
      },
      fastSwitchEnabled: true,
    },
  } as MediaPlayerSettingClass);

  return dash;
github diy4869 / LoPlayer / src / js / index.js View on Github external
})
            hls.on(Hls.Events.BUFFER_RESET, () => {
              console.log('test')
            })
          } else if (this.player.canPlayType('application/vnd.apple.mpegurl')) {
            source.src = this.options.src[this.currentIndex].src
            this.player.addEventListener('canplay', () => {
              this.play()
            })
          }
        }
        break
      case 'dash':
        console.log('dash')
        if (dashjs) {
          const player = dashjs.MediaPlayer().create()
          player.initialize(this.player, this.options.src[this.currentIndex].src, true)
        }
        break
      default:
        source.src = this.options.src[this.currentIndex].src
        source.type = this.options.src[this.currentIndex].type
        break
    }
  }
github matrix-org / matrix-vr-demo / src / js / components / TourismScene.js View on Github external
document.querySelectorAll('span#tourism video').forEach((video, index) => {
            if (!video.player) {
                video.player = dashPlayer().create();
                video.player.getDebug().setLogToBrowserConsole(false);
                video.player.initialize(video, VIDEOS[index], false);
                video.player.setFastSwitchEnabled(true);
                video.player.setInitialRepresentationRatioFor('video', 1);
                video.player.on('error', console.error);
            }
            video.player.seek(0);
            this.videos.push(video);
        });
    }
github MoePlayer / angular-moeplayer / projects / d-player / src / lib / mse / dash.directive.ts View on Github external
constructor(
    @Host() @Self() @Optional() private _dp: DPlayerComponent
  ) {
    try {
      this._instance = MediaPlayer().create();
      this._instance.getDebug().setLogToBrowserConsole(false);
      this._dp.MSE.push(this.init);
    } finally {
    }
  }
github Dash-Industry-Forum / dash.js / samples / modules / webpack / src / entry.js View on Github external
import {MediaPlayer} from 'dashjs';

let url = "https://dash.akamaized.net/envivio/Envivio-dash2/manifest.mpd";
let player = MediaPlayer().create();
player.initialize(document.querySelector('#myMainVideoPlayer'), url, true);
github Eyevinn / html-player / src / playerTechs / mss_player.js View on Github external
return new Promise((resolve, reject) => {
      let mediaPlayer = MediaPlayer().create();
      mediaPlayer.initialize();
      mediaPlayer.attachView(this.videoElement_);
      mediaPlayer.attachSource(this.manifestUrl_);
      mediaPlayer.on(MediaPlayer.events.MANIFEST_LOADED, () => {
        resolve();
      });
      mediaPlayer.on(MediaPlayer.events.ERROR, ev => {
        reject(`Failed to load Mss Player: ${ev.error.message}`);
      });
      this.mediaPlayer_ = mediaPlayer;
    });
  }
github imerkle / ireact-player / src / renderers / HTML5.js View on Github external
load = (url) => {
    let hls = new Hls();
    if (this.shouldUseHLS(url)) {
        hls.loadSource(url);
        hls.attachMedia(this.player);
    }
    if (this.shouldUseDASH(url)) {
        const player = dashjs.MediaPlayer().create()
        player.getDebug().setLogToBrowserConsole(false)
        player.initialize(this.player, url, false)
    }
  }
  shouldUseHLS (url) {
github Eyevinn / html-player / src / playerTechs / mss_player.js View on Github external
return new Promise((resolve, reject) => {
      let mediaPlayer = MediaPlayer().create();
      mediaPlayer.initialize();
      mediaPlayer.attachView(this.videoElement_);
      mediaPlayer.attachSource(this.manifestUrl_);
      mediaPlayer.on(MediaPlayer.events.MANIFEST_LOADED, () => {
        resolve();
      });
      mediaPlayer.on(MediaPlayer.events.ERROR, ev => {
        reject(`Failed to load Mss Player: ${ev.error.message}`);
      });
      this.mediaPlayer_ = mediaPlayer;
    });
  }
github Eyevinn / html-player / src / playerTechs / mss_player.js View on Github external
return new Promise((resolve, reject) => {
      let mediaPlayer = MediaPlayer().create();
      mediaPlayer.initialize();
      mediaPlayer.attachView(this.videoElement_);
      mediaPlayer.attachSource(this.manifestUrl_);
      mediaPlayer.on(MediaPlayer.events.MANIFEST_LOADED, () => {
        resolve();
      });
      mediaPlayer.on(MediaPlayer.events.ERROR, ev => {
        reject(`Failed to load Mss Player: ${ev.error.message}`);
      });
      this.mediaPlayer_ = mediaPlayer;
    });
  }

dashjs

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.

BSD-3-Clause
Latest version published 9 months ago

Package Health Score

85 / 100
Full package analysis