Skip to content

Commit 83e8ac2

Browse files
committed
add webglInitError error
1 parent c5e974b commit 83e8ac2

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

demo/public/dist.zip

771 Bytes
Binary file not shown.

dist/decoder.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jessibuca.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/constant/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export const EVENTS_ERROR = {
212212
wasmDecodeError: 'wasmDecodeError',
213213
webglAlignmentError: 'webglAlignmentError',
214214
webglContextLostError: 'webglContextLostError',
215-
215+
webglInitError: 'webglInitError',
216216
}
217217

218218

src/jessibuca.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,13 @@ class Jessibuca extends Emitter {
416416
});
417417
})
418418

419+
this.player.once(EVENTS_ERROR.webglInitError, () => {
420+
this.pause().then(() => {
421+
this.debug.log('Jessibuca', 'webglInitError and paused');
422+
}).catch(() => {
423+
this.debug.warn('Jessibuca', 'webglInitError and paused error')
424+
});
425+
})
419426

420427
this.player.once(EVENTS_ERROR.mediaSourceH265NotSupport, () => {
421428
this.pause().then(() => {

src/video/canvasLoader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default class CanvasVideoLoader extends CommonLoader {
7575
this.contextGlDestroy = webgl.destroy
7676
} else {
7777
this.player.debug.error(`CanvasVideoLoader`, 'init webgl fail');
78+
this.player.emitError(EVENTS_ERROR.webglInitError);
7879
}
7980
}
8081

@@ -126,7 +127,7 @@ export default class CanvasVideoLoader extends CommonLoader {
126127
try {
127128
this.contextGlRender(this.$videoElement.width, this.$videoElement.height, msg.output[0], msg.output[1], msg.output[2]);
128129
} catch (e) {
129-
this.player.debug.error('CanvasVideoLoader', 'render', e);
130+
this.player.debug.error('CanvasVideoLoader', 'webgl render error and emit webglContextLostError', e);
130131
this.isContextGlRenderLost = true;
131132
this.player.emitError(EVENTS_ERROR.webglContextLostError)
132133
}

0 commit comments

Comments
 (0)