Skip to content

Commit

Permalink
[build] 0.6.1
Browse files Browse the repository at this point in the history
update chimee-kernel
  • Loading branch information
toxic-johann committed Nov 25, 2017
1 parent 5559e92 commit 1ee7d9e
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 73 deletions.
2 changes: 1 addition & 1 deletion bundle-size/min.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-size/umd.html

Large diffs are not rendered by default.

116 changes: 53 additions & 63 deletions lib/index.browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* chimee v0.6.0
* chimee v0.6.1
* (c) 2017 toxic-johann
* Released under MIT
*/
Expand Down Expand Up @@ -5143,6 +5143,10 @@ var defaultConfig$1 = {
reloadTime: 1500 // video can't play when this time to reload
};

var $const = {
kernelEvent: ['mediaInfo', 'heartbeat', 'error']
};

var Kernel = function (_CustEvent) {
_inherits(Kernel, _CustEvent);

Expand All @@ -5162,7 +5166,6 @@ var Kernel = function (_CustEvent) {
_this.video = videoElement;
_this.videokernel = _this.selectKernel();
_this.bindEvents(_this.videokernel, _this.video);
_this.timer = null;
return _this;
}

Expand All @@ -5177,16 +5180,14 @@ var Kernel = function (_CustEvent) {
value: function bindEvents(videokernel, video) {
var _this2 = this;

if (videokernel) {
videokernel.on('mediaInfo', function (mediaInfo) {
_this2.emit('mediaInfo', mediaInfo);
});

video.addEventListener('canplay', function () {
clearTimeout(_this2.timer);
_this2.timer = null;
});
if (!videokernel) {
return;
}
$const.kernelEvent.forEach(function (item) {
videokernel.on(item, function (msg) {
_this2.emit(item, msg.data);
});
});
}

/**
Expand All @@ -5198,6 +5199,7 @@ var Kernel = function (_CustEvent) {
key: 'selectKernel',
value: function selectKernel() {
var config = this.config;
isObject$1(config.preset) || (config.preset = {});
var box = config.box;
var src = config.src.toLowerCase();
// 根据 src 判断 box
Expand All @@ -5219,23 +5221,24 @@ var Kernel = function (_CustEvent) {
Log.error(this.tag, 'You want to play for ' + box + ', but you have not installed the kernel.');
return;
}
// 调用各个 box
if (box === 'native') {
return new Native(this.video, config);
} else if (box === 'flv') {
return new config.preset[box](this.video, config);
} else if (box === 'hls') {
return new config.preset[box](this.video, config);
} else if (box === 'mp4') {
if (config.preset[box] && config.preset[box].isSupport()) {
return new config.preset[box](this.video, config);
} else {
if (box === 'mp4') {
if (!config.preset[box] || !config.preset[box].isSupport()) {
Log.verbose(this.tag, 'browser is not support mp4 decode, auto switch native player');
return new Native(this.video, config);
box = 'native';
}
} else {
Log.error(this.tag, 'not mactch any player, please check your config');
return null;
}

// 调用各个 box
switch (box) {
case 'native':
return new Native(this.video, config);
case 'mp4':
case 'flv':
case 'hls':
return new config.preset[box](this.video, config);
default:
Log.error(this.tag, 'not mactch any player, please check your config');
return;
}
}

Expand All @@ -5247,11 +5250,11 @@ var Kernel = function (_CustEvent) {
}, {
key: 'attachMedia',
value: function attachMedia() {
if (this.videokernel) {
this.videokernel.attachMedia();
} else {
Log.error(this.tag, 'videokernel is not already, must init player');
if (!this.videokernel) {
return Log.error(this.tag, 'videokernel is not already, must init player');
}

this.videokernel.attachMedia();
}
/**
* load source
Expand All @@ -5262,21 +5265,12 @@ var Kernel = function (_CustEvent) {
}, {
key: 'load',
value: function load(src) {
var _this3 = this;

this.config.src = src || this.config.src;
if (this.videokernel && this.config.src) {
this.videokernel.load(this.config.src);
if (!this.timer && this.box !== 'hls') {
this.timer = setTimeout(function () {
_this3.timer = null;
_this3.pause();
_this3.refresh();
}, this.config.reloadTime);
}
} else {
Log.error(this.tag, 'videokernel is not already, must init player');
if (!this.videokernel || !this.config.src) {
return Log.error(this.tag, 'videokernel is not already, must init player');
}

this.videokernel.load(this.config.src);
}
/**
* destory kernel
Expand All @@ -5286,13 +5280,11 @@ var Kernel = function (_CustEvent) {
}, {
key: 'destroy',
value: function destroy() {
if (this.videokernel) {
this.videokernel.destroy();
clearTimeout(this.timer);
this.timer = null;
} else {
Log.error(this.tag, 'videokernel is not exit');
if (!this.videokernel) {
return Log.error(this.tag, 'videokernel is not exit');
}

this.videokernel.destroy();
}
/**
* to play
Expand All @@ -5302,11 +5294,11 @@ var Kernel = function (_CustEvent) {
}, {
key: 'play',
value: function play() {
if (this.videokernel) {
this.videokernel.play();
} else {
Log.error(this.tag, 'videokernel is not already, must init player');
if (!this.videokernel) {
return Log.error(this.tag, 'videokernel is not already, must init player');
}

this.videokernel.play();
}
/**
* pause
Expand All @@ -5316,11 +5308,10 @@ var Kernel = function (_CustEvent) {
}, {
key: 'pause',
value: function pause() {
if (this.videokernel && this.config.src) {
this.videokernel.pause();
} else {
Log.error(this.tag, 'videokernel is not already, must init player');
if (!this.videokernel || !this.config.src) {
return Log.error(this.tag, 'videokernel is not already, must init player');
}
this.videokernel.pause();
}
/**
* get video currentTime
Expand Down Expand Up @@ -5353,11 +5344,10 @@ var Kernel = function (_CustEvent) {
}, {
key: 'refresh',
value: function refresh() {
if (this.videokernel) {
this.videokernel.refresh();
} else {
Log.error(this.tag, 'videokernel is not already, must init player');
if (!this.videokernel) {
return Log.error(this.tag, 'videokernel is not already, must init player');
}
this.videokernel.refresh();
}
/**
* get video duration
Expand Down Expand Up @@ -8702,7 +8692,7 @@ var Plugin = (_dec$3 = autobindClass(), _dec$3(_class$3 = function (_VideoWrappe
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));

_this.destroyed = false;
_this.VERSION = '0.6.0';
_this.VERSION = '0.6.1';
_this.__operable = true;
_this.__level = 0;

Expand Down Expand Up @@ -10644,7 +10634,7 @@ var Chimee = (_dec = autobindClass(), _dec(_class = (_class2 = (_temp = _class3
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'version', [frozen], {
enumerable: true,
initializer: function initializer() {
return '0.6.0';
return '0.6.1';
}
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'config', [frozen], {
enumerable: true,
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* chimee v0.6.0
* chimee v0.6.1
* (c) 2017 toxic-johann
* Released under MIT
*/
Expand Down Expand Up @@ -1438,7 +1438,7 @@ var Plugin = (_dec$3 = toxicDecorators.autobindClass(), _dec$3(_class$3 = functi
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));

_this.destroyed = false;
_this.VERSION = '0.6.0';
_this.VERSION = '0.6.1';
_this.__operable = true;
_this.__level = 0;

Expand Down Expand Up @@ -3099,7 +3099,7 @@ var Chimee = (_dec = toxicDecorators.autobindClass(), _dec(_class = (_class2 = (
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'version', [toxicDecorators.frozen], {
enumerable: true,
initializer: function initializer() {
return '0.6.0';
return '0.6.1';
}
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'config', [toxicDecorators.frozen], {
enumerable: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/index.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* chimee v0.6.0
* chimee v0.6.1
* (c) 2017 toxic-johann
* Released under MIT
*/
Expand Down Expand Up @@ -1434,7 +1434,7 @@ var Plugin = (_dec$3 = autobindClass(), _dec$3(_class$3 = function (_VideoWrappe
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));

_this.destroyed = false;
_this.VERSION = '0.6.0';
_this.VERSION = '0.6.1';
_this.__operable = true;
_this.__level = 0;

Expand Down Expand Up @@ -3095,7 +3095,7 @@ var Chimee = (_dec = autobindClass(), _dec(_class = (_class2 = (_temp = _class3
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'version', [frozen], {
enumerable: true,
initializer: function initializer() {
return '0.6.0';
return '0.6.1';
}
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'config', [frozen], {
enumerable: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chimee",
"version": "0.6.0",
"version": "0.6.1",
"description": "a video-player aims to bring wonderful experience on browser",
"main": "lib/index.js",
"module": "lib/index.mjs",
Expand Down

0 comments on commit 1ee7d9e

Please sign in to comment.