js类的有点不熟悉,找不到可以参考的例子哦。。。
var jsmpeg = window.jsmpeg = function( url, opts ) {
opts = opts || {};
this.benchmark = !!opts.benchmark;
this.canvas = opts.canvas || document.createElement('canvas');
this.autoplay = !!opts.autoplay;
this.loop = !!opts.loop;
this.seekable = !!opts.seekable;
this.externalLoadCallback = opts.onload || null;x
this.externalDecodeCallback = opts.ondecodeframe || null;
this.externalFinishedCallback = opts.onfinished || null;
this.customIntraQuantMatrix = new Uint8Array(64);
this.customNonIntraQuantMatrix = new Uint8Array(64);
this.blockData = new Int32Array(64);
this.zeroBlockData = new Int32Array(64);
this.fillArray(this.zeroBlockData, 0);
// use WebGL for YCbCrToRGBA conversion if possible (much faster)
if( !opts.forceCanvas2D && this.initWebGL() ) {
this.renderFrame = this.renderFrameGL;
} else {
this.canvasContext = this.canvas.getContext('2d');
this.renderFrame = this.renderFrame2D;
}
if( url instanceof WebSocket ) {
this.client = url;
this.client.onopen = this.initSocketClient.bind(this);
}
else {
this.load(url);
}
};
例如这种js的签名该怎么写哦?
我来回答