diff --git a/__tests__/kernel-event.js b/__tests__/kernel-event.js index c8931c1c..5b907acd 100644 --- a/__tests__/kernel-event.js +++ b/__tests__/kernel-event.js @@ -24,7 +24,7 @@ describe('kernel-events', () => { test('error check', () => { const fn = jest.fn(); chimee.on('error', fn); - expect(() => chimee.__dispatcher.kernel.emit('error')).toThrow(); + expect(() => chimee.__dispatcher.kernel.emit('error')).not.toThrow(); expect(fn).toHaveBeenCalledTimes(1); }); }); diff --git a/demo/hls/index.js b/demo/hls/index.js index d2386b8f..9bdc9488 100644 --- a/demo/hls/index.js +++ b/demo/hls/index.js @@ -1,5 +1,6 @@ const player = new window.Chimee({ - src: 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8', + // src: 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8', + src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/44_176_20170224113626af3a75cd-3508-4bc3-b51f-366fca3c7e39.m3u8', // 编解码容器 box: 'hls', // flv hls mp4 // dom容器 diff --git a/package.json b/package.json index 2357b690..d6ff96a5 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "toxic-decorators": "^0.3.8" }, "devDependencies": { - "@std/esm": "^0.23.0", + "@std/esm": "^0.24.0", "babel-eslint": "^8.2.2", "babel-jest": "^22.4.1", "babel-plugin-external-helpers": "^6.22.0", @@ -65,9 +65,9 @@ "babel-preset-stage-0": "^6.24.1", "chai": "^4.1.2", "chimee-kernel-flv": "^1.4.10", - "chimee-kernel-hls": "^1.2.0", - "chimee-mobile-player": "0.0.5", - "chimee-plugin-center-state": "0.0.8", + "chimee-kernel-hls": "^1.3.0", + "chimee-mobile-player": "^0.1.1", + "chimee-plugin-center-state": "0.0.10", "chimee-plugin-controlbar": "^0.4.0", "chimee-plugin-danmu": "0.0.9", "chimee-plugin-popup": "0.0.7", @@ -87,9 +87,9 @@ "mocha": "^5.0.1", "npm-check-updates": "^2.13.0", "pkg-ok": "^2.1.0", - "rollup": "^0.56.2", + "rollup": "^0.56.4", "rollup-plugin-babel": "^3.0.2", - "rollup-plugin-commonjs": "^8.3.0", + "rollup-plugin-commonjs": "^8.4.0", "rollup-plugin-flow-no-whitespace": "^1.0.0", "rollup-plugin-livereload": "^0.6.0", "rollup-plugin-node-resolve": "^3.0.3", diff --git a/src/index.js b/src/index.js index 43b65aed..6575b045 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ // @flow import Dispatcher from './dispatcher/index'; -import { isString, isFunction, isElement, isObject, Log } from 'chimee-helper'; +import { isString, isFunction, isElement, isObject, Log, isError } from 'chimee-helper'; import Plugin from './dispatcher/plugin'; import { frozen, autobindClass } from 'toxic-decorators'; import VideoWrapper from 'dispatcher/video-wrapper'; @@ -101,6 +101,7 @@ export default class Chimee extends VideoWrapper { const errorHandler = this.config.errorHandler || Chimee.config.errorHandler; if (isFunction(errorHandler)) return errorHandler(error); if (Chimee.config.silent) return; - throw error; + if (isError(error)) throw error; + else console.error(error); } }