mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
创建mse
This commit is contained in:
1 parent
50d1457e7e
commit
2e0d70292b
9 files changed
+99
-19
No files matched your search
@@ -1,24 +1,61 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global['artplayer-plugin-flv'] = {})));
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global['artplayer-plugin-flv'] = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
function artplayerPluginFlv(art) {
|
||||
return {
|
||||
load: function load(url) {
|
||||
return new Promise(function (resolve) {
|
||||
resolve('https://blog.zhw-island.com/assets-cdn/video/one-more-time-one-more-chance-480p.mp4');
|
||||
});
|
||||
}
|
||||
};
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
|
||||
window.artplayerPluginFlv = artplayerPluginFlv;
|
||||
var classCallCheck = _classCallCheck;
|
||||
|
||||
exports.default = artplayerPluginFlv;
|
||||
function checkSupport(art) {
|
||||
var _art$constructor = art.constructor,
|
||||
errorHandle = _art$constructor.utils.errorHandle,
|
||||
mimeCodec = _art$constructor.config.mimeCodec;
|
||||
var $video = art.template.$video;
|
||||
var canPlay = $video.canPlayType(mimeCodec.mp4);
|
||||
errorHandle(window.MediaSource && window.MediaSource.isTypeSupported(mimeCodec.mp4) && (canPlay === 'probably' || canPlay === 'maybe'), "Unsupported MIME type or codec: ".concat(mimeCodec.mp4));
|
||||
}
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
var CreatMediaSource = function CreatMediaSource(art) {
|
||||
classCallCheck(this, CreatMediaSource);
|
||||
|
||||
this.mediaSource = new MediaSource();
|
||||
this.url = URL.createObjectURL(this.mediaSource);
|
||||
};
|
||||
|
||||
var Flv = function Flv(art) {
|
||||
classCallCheck(this, Flv);
|
||||
|
||||
checkSupport(art);
|
||||
this.mediaSource = new CreatMediaSource(art);
|
||||
|
||||
this.load = function (url) {
|
||||
console.log(url);
|
||||
};
|
||||
};
|
||||
|
||||
function artplayerPluginFlv(art) {
|
||||
var flv = new Flv(art);
|
||||
return {
|
||||
load: function load(url) {
|
||||
return new Promise(function (resolve) {
|
||||
flv.load(url);
|
||||
return resolve(flv.mediaSource.url);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
window.artplayerPluginFlv = artplayerPluginFlv;
|
||||
|
||||
exports.default = artplayerPluginFlv;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=artplayer-plugin-flv.js.map
|
||||
Reference in new issue
Block a user