Closed KadeejaBai closed 4 years ago
Yeah it's possible, you just need to include dashjs to your project and initialize it and attach the videotag;
import {Lightning, MediaPlayer} from 'wpe-lightning-sdk';
export default class Player extends Lightning.Component {
static _template(){
return {
MediaPlayer:{ type: MediaPlayer },
Controls: { ... }
}
}
_init(){
// get ref to video-tag
cont video = this.tag("MediaPlayer").videoEl;
// create new context
this.dash = dashjs.MediaPlayer().create();
this.dash.initialize();
// attach video reference
this.dash.attachView(video);
}
play(manifest, drm){
// hand over license
this.dash.setProtectionData(drm);
// set manifest
this.dash.attachSource(manifest);
}
}
I'm facing an error while importing dashjs. Am i doing anything wrong?
import {Lightning, MediaPlayer} from 'wpe-lightning-sdk';
import dashjs from 'dashjs';
export default class Player extends Lightning.Component {
static _template(){
return {
MediaPlayer:{ type: MediaPlayer },
Controls: { ... }
}
}
_init(){
// get ref to video-tag
cont video = this.tag("MediaPlayer").videoEl;
// create new context
this.dash = dashjs.MediaPlayer().create();
this.dash.initialize();
// attach video reference
this.dash.attachView(video);
}
play(manifest, drm){
// hand over license
this.dash.setProtectionData(drm);
// set manifest
this.dash.attachSource(manifest);
}
Is it possible to share an example that we can run and debug?
I believe this error is due to the dashjs import. The code updated with the comment.
This is the version of dashjs that I'm using.
"dashjs": "^3.1.1"
Fixed :) this was the import
import 'dashjs/dist/dash.all.min'
Here video is not displaying but audio is comming
import {Lightning, MediaPlayer} from 'wpe-lightning-sdk'; import 'dashjs/dist/dash.all.debug'
export default class DRM extends Lightning.Component { static _template(){ return { MediaPlayer:{ type: MediaPlayer },
}
}
_init(){
console.log(dashjs)
const video = this.tag("MediaPlayer").videoEl;
this.dash = dashjs.MediaPlayer().create();
this.dash.initialize();
console.log(this.dash)
this.dash.attachView(video);
} _handleEnter(){ this.dash.attachSource('https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd');
} } what will be the reason please help me
I'm looking for dash support for mediaplayer. Is it possible to use dash.js with a mediaplayer?