diff --git a/README.md b/README.md
index 189d27841..3311a41b6 100644
--- a/README.md
+++ b/README.md
@@ -106,7 +106,6 @@ var art = new Artplayer({
- [artplayer-plugin-chromecast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast)
- [artplayer-plugin-vast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast) (WIP)
- [artplayer-plugin-chapter](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter)
-- [artplayer-plugin-canvas](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-canvas/index.js&example=canvas) (WIP)
## Library
@@ -116,6 +115,11 @@ var art = new Artplayer({
- [mpegts.js](https://artplayer.org/?libs=https://cdn.jsdelivr.net/npm/mpegts.js@1.7.3/dist/mpegts.min.js&example=mpegts)
- [webtorrent.js](https://artplayer.org/?libs=https://cdn.jsdelivr.net/npm/webtorrent@1/webtorrent.min.js&example=webtorrent)
+## Proxys
+
+- [WebAV](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-webav/index.js&example=webav) (WIP)
+- [libmedia](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-libmedia/index.js&example=libmedia) (WIP)
+
## Changelog
[CHANGELOG_CN.md](./CHANGELOG_CN.md)
diff --git a/docs/assets/example/canvas.js b/docs/assets/example/canvas.js
deleted file mode 100644
index 426b41e4d..000000000
--- a/docs/assets/example/canvas.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// npm i artplayer-plugin-canvas
-// import ArtplayerPluginCanvas from 'artplayer-plugin-canvas';
-
-var art = new Artplayer({
- container: '.artplayer-app',
- url: '/assets/sample/video.mp4',
- Canvas: ArtplayerPluginCanvas,
-});
\ No newline at end of file
diff --git a/docs/assets/example/libmedia.js b/docs/assets/example/libmedia.js
new file mode 100644
index 000000000..fd2784dfa
--- /dev/null
+++ b/docs/assets/example/libmedia.js
@@ -0,0 +1,10 @@
+// npm i artplayer-proxy-libmedia
+// import artplayerProxyLibmedia from 'artplayer-proxy-libmedia';
+
+var art = new Artplayer({
+ container: '.artplayer-app',
+ url: '/assets/sample/video.mp4',
+ proxy: artplayerProxyLibmedia({
+ //
+ }),
+});
\ No newline at end of file
diff --git a/docs/assets/example/webav.js b/docs/assets/example/webav.js
new file mode 100644
index 000000000..611121bb8
--- /dev/null
+++ b/docs/assets/example/webav.js
@@ -0,0 +1,10 @@
+// npm i artplayer-proxy-webav
+// import artplayerProxyWebAV from 'artplayer-proxy-webav';
+
+var art = new Artplayer({
+ container: '.artplayer-app',
+ url: '/assets/sample/video.mp4',
+ proxy: artplayerProxyWebAV({
+ //
+ }),
+});
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index dd570dff0..174f53e5e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -72,9 +72,16 @@
artplayer-plugin-chapter
+
+
diff --git a/docs/uncompiled/artplayer-plugin-canvas/index.js.map b/docs/uncompiled/artplayer-plugin-canvas/index.js.map
deleted file mode 100644
index 6b4eb2a6e..000000000
--- a/docs/uncompiled/artplayer-plugin-canvas/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAe,MAAM,8BAA8B;IAC/C,YAAY,GAAG,CAAE;QACb,KAAK;QAEL,IAAI,CAAC,GAAG,GAAG;QACX,QAAQ,GAAG,CAAC;QAEZ,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,aAAa,GAAG;QAErB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,MAAM,GAAG;QACd,I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,QAAQ,GAAG,CAAC;IAChB;AACJ;kBAzFqB;AA2FrB,IAAI,OAAO,WAAW,aAAa;IAC/B,MAAM,CAAC,wBAAwB,GAAG;IAElC,IAAI,CAAC,eAAe,GAAG,CAAC,sBACpB,eAAe,MAAM,CAAC,qBAAqB,uBAAuB;QAAE,SAAS;IAAS;AAE9F;;;ACjGA,QAAQ,cAAc,GAAG,SAAU,CAAC;IAClC,OAAO,KAAK,EAAE,UAAU,GAAG,IAAI;QAAC,SAAS;IAAC;AAC5C;AAEA,QAAQ,iBAAiB,GAAG,SAAU,CAAC;IACrC,OAAO,cAAc,CAAC,GAAG,cAAc;QAAC,OAAO;IAAI;AACrD;AAEA,QAAQ,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI;IACxC,OAAO,IAAI,CAAC,QAAQ,OAAO,CAAC,SAAU,GAAG;QACvC,IACE,QAAQ,aACR,QAAQ,gBACR,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,MAE3C;QAGF,OAAO,cAAc,CAAC,MAAM,KAAK;YAC/B,YAAY;YACZ,KAAK;gBACH,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;IACF;IAEA,OAAO;AACT;AAEA,QAAQ,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG;IAC5C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY;QACZ,KAAK;IACP;AACF","sources":["packages/artplayer-plugin-canvas/src/index.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["export default class ArtplayerPluginCanvas extends HTMLCanvasElement {\n constructor(art) {\n super();\n\n this.art = art;\n console.log(art);\n\n this._muted = false;\n this._volume = 1;\n this._src = '';\n this._currentTime = 0;\n this._playbackRate = 1;\n\n this.loop = false;\n this.ended = false;\n this.paused = true;\n this.readyState = 0;\n this.videoWidth = 0;\n this.videoHeight = 0;\n this.autoplay = false;\n this.duration = NaN;\n\n this.buffered = {\n length: 0,\n start: () => 0,\n end: () => 0,\n };\n\n this.textTracks = [{ activeCues: [] }];\n }\n\n get muted() {\n console.log('get muted');\n return this._muted;\n }\n\n set muted(muted) {\n console.log('set muted');\n this._muted = muted;\n }\n\n get volume() {\n console.log('get volume');\n return this._volume;\n }\n\n set volume(percentage) {\n console.log('set volume');\n this._volume = percentage;\n }\n\n get src() {\n console.log('get src');\n return this._src;\n }\n\n set src(newSrc) {\n console.log('set src');\n this._src = newSrc;\n }\n\n get currentTime() {\n console.log('get currentTime');\n return this._currentTime;\n }\n\n set currentTime(time) {\n console.log('set currentTime');\n this._currentTime = time;\n }\n\n get playbackRate() {\n console.log('get playbackRate');\n return this._playbackRate;\n }\n\n set playbackRate(rate) {\n console.log('set playbackRate');\n this._playbackRate = rate;\n }\n\n async play() {\n console.log('play');\n return true;\n }\n\n pause() {\n console.log('pause');\n }\n}\n\nif (typeof window !== 'undefined') {\n window['ArtplayerPluginCanvas'] = ArtplayerPluginCanvas;\n\n if (!customElements.get('art-plugin-canvas')) {\n customElements.define('art-plugin-canvas', ArtplayerPluginCanvas, { extends: 'canvas' });\n }\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../"}
\ No newline at end of file
diff --git a/docs/uncompiled/artplayer-plugin-canvas/index.js b/docs/uncompiled/artplayer-proxy-libmedia/index.js
similarity index 69%
rename from docs/uncompiled/artplayer-plugin-canvas/index.js
rename to docs/uncompiled/artplayer-proxy-libmedia/index.js
index 4486aad0b..0c60baf80 100644
--- a/docs/uncompiled/artplayer-plugin-canvas/index.js
+++ b/docs/uncompiled/artplayer-proxy-libmedia/index.js
@@ -142,93 +142,16 @@
this[globalName] = mainExports;
}
}
-})({"2pQPp":[function(require,module,exports) {
+})({"9cz2W":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-class ArtplayerPluginCanvas extends HTMLCanvasElement {
- constructor(art){
- super();
- this.art = art;
- console.log(art);
- this._muted = false;
- this._volume = 1;
- this._src = "";
- this._currentTime = 0;
- this._playbackRate = 1;
- this.loop = false;
- this.ended = false;
- this.paused = true;
- this.readyState = 0;
- this.videoWidth = 0;
- this.videoHeight = 0;
- this.autoplay = false;
- this.duration = NaN;
- this.buffered = {
- length: 0,
- start: ()=>0,
- end: ()=>0
- };
- this.textTracks = [
- {
- activeCues: []
- }
- ];
- }
- get muted() {
- console.log("get muted");
- return this._muted;
- }
- set muted(muted) {
- console.log("set muted");
- this._muted = muted;
- }
- get volume() {
- console.log("get volume");
- return this._volume;
- }
- set volume(percentage) {
- console.log("set volume");
- this._volume = percentage;
- }
- get src() {
- console.log("get src");
- return this._src;
- }
- set src(newSrc) {
- console.log("set src");
- this._src = newSrc;
- }
- get currentTime() {
- console.log("get currentTime");
- return this._currentTime;
- }
- set currentTime(time) {
- console.log("set currentTime");
- this._currentTime = time;
- }
- get playbackRate() {
- console.log("get playbackRate");
- return this._playbackRate;
- }
- set playbackRate(rate) {
- console.log("set playbackRate");
- this._playbackRate = rate;
- }
- async play() {
- console.log("play");
- return true;
- }
- pause() {
- console.log("pause");
- }
-}
-exports.default = ArtplayerPluginCanvas;
-if (typeof window !== "undefined") {
- window["ArtplayerPluginCanvas"] = ArtplayerPluginCanvas;
- if (!customElements.get("art-plugin-canvas")) customElements.define("art-plugin-canvas", ArtplayerPluginCanvas, {
- extends: "canvas"
- });
+parcelHelpers.export(exports, "default", ()=>artplayerProxyLibmedia);
+function artplayerProxyLibmedia(option) {
+ return (art)=>{
+ return document.createElement("video");
+ };
}
+if (typeof window !== "undefined") window["artplayerProxyLibmedia"] = artplayerProxyLibmedia;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"5dUr6"}],"5dUr6":[function(require,module,exports) {
exports.interopDefault = function(a) {
@@ -260,6 +183,6 @@ exports.export = function(dest, destName, get) {
});
};
-},{}]},["2pQPp"], "2pQPp", "parcelRequire4dc0")
+},{}]},["9cz2W"], "9cz2W", "parcelRequire4dc0")
//# sourceMappingURL=index.js.map
diff --git a/docs/uncompiled/artplayer-proxy-libmedia/index.js.map b/docs/uncompiled/artplayer-proxy-libmedia/index.js.map
new file mode 100644
index 000000000..697fdd8bd
--- /dev/null
+++ b/docs/uncompiled/artplayer-proxy-libmedia/index.js.map
@@ -0,0 +1 @@
+{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAAwB;AAAT,SAAS,uBAAuB,MAAM;IACjD,OAAO,CAAC;QACJ,OAAO,SAAS,aAAa,CAAC;IAClC;AACJ;AAEA,IAAI,OAAO,WAAW,aAClB,MAAM,CAAC,yBAAyB,GAAG;;;ACPvC,QAAQ,cAAc,GAAG,SAAU,CAAC;IAClC,OAAO,KAAK,EAAE,UAAU,GAAG,IAAI;QAAC,SAAS;IAAC;AAC5C;AAEA,QAAQ,iBAAiB,GAAG,SAAU,CAAC;IACrC,OAAO,cAAc,CAAC,GAAG,cAAc;QAAC,OAAO;IAAI;AACrD;AAEA,QAAQ,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI;IACxC,OAAO,IAAI,CAAC,QAAQ,OAAO,CAAC,SAAU,GAAG;QACvC,IACE,QAAQ,aACR,QAAQ,gBACR,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,MAE3C;QAGF,OAAO,cAAc,CAAC,MAAM,KAAK;YAC/B,YAAY;YACZ,KAAK;gBACH,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;IACF;IAEA,OAAO;AACT;AAEA,QAAQ,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG;IAC5C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY;QACZ,KAAK;IACP;AACF","sources":["packages/artplayer-proxy-libmedia/src/index.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["export default function artplayerProxyLibmedia(option) {\n return (art) => {\n return document.createElement('video');\n };\n}\n\nif (typeof window !== 'undefined') {\n window['artplayerProxyLibmedia'] = artplayerProxyLibmedia;\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../"}
\ No newline at end of file
diff --git a/docs/uncompiled/artplayer-proxy-webav/index.js b/docs/uncompiled/artplayer-proxy-webav/index.js
new file mode 100644
index 000000000..00d305be4
--- /dev/null
+++ b/docs/uncompiled/artplayer-proxy-webav/index.js
@@ -0,0 +1,188 @@
+// modules are defined as an array
+// [ module function, map of requires ]
+//
+// map of requires is short require name -> numeric require
+//
+// anything defined in a previous bundle is accessed via the
+// orig method which is the require for previous bundles
+
+(function (modules, entry, mainEntry, parcelRequireName, globalName) {
+ /* eslint-disable no-undef */
+ var globalObject =
+ typeof globalThis !== 'undefined'
+ ? globalThis
+ : typeof self !== 'undefined'
+ ? self
+ : typeof window !== 'undefined'
+ ? window
+ : typeof global !== 'undefined'
+ ? global
+ : {};
+ /* eslint-enable no-undef */
+
+ // Save the require from previous bundle to this closure if any
+ var previousRequire =
+ typeof globalObject[parcelRequireName] === 'function' &&
+ globalObject[parcelRequireName];
+
+ var cache = previousRequire.cache || {};
+ // Do not use `require` to prevent Webpack from trying to bundle this call
+ var nodeRequire =
+ typeof module !== 'undefined' &&
+ typeof module.require === 'function' &&
+ module.require.bind(module);
+
+ function newRequire(name, jumped) {
+ if (!cache[name]) {
+ if (!modules[name]) {
+ // if we cannot find the module within our internal map or
+ // cache jump to the current global require ie. the last bundle
+ // that was added to the page.
+ var currentRequire =
+ typeof globalObject[parcelRequireName] === 'function' &&
+ globalObject[parcelRequireName];
+ if (!jumped && currentRequire) {
+ return currentRequire(name, true);
+ }
+
+ // If there are other bundles on this page the require from the
+ // previous one is saved to 'previousRequire'. Repeat this as
+ // many times as there are bundles until the module is found or
+ // we exhaust the require chain.
+ if (previousRequire) {
+ return previousRequire(name, true);
+ }
+
+ // Try the node require function if it exists.
+ if (nodeRequire && typeof name === 'string') {
+ return nodeRequire(name);
+ }
+
+ var err = new Error("Cannot find module '" + name + "'");
+ err.code = 'MODULE_NOT_FOUND';
+ throw err;
+ }
+
+ localRequire.resolve = resolve;
+ localRequire.cache = {};
+
+ var module = (cache[name] = new newRequire.Module(name));
+
+ modules[name][0].call(
+ module.exports,
+ localRequire,
+ module,
+ module.exports,
+ this
+ );
+ }
+
+ return cache[name].exports;
+
+ function localRequire(x) {
+ var res = localRequire.resolve(x);
+ return res === false ? {} : newRequire(res);
+ }
+
+ function resolve(x) {
+ var id = modules[name][1][x];
+ return id != null ? id : x;
+ }
+ }
+
+ function Module(moduleName) {
+ this.id = moduleName;
+ this.bundle = newRequire;
+ this.exports = {};
+ }
+
+ newRequire.isParcelRequire = true;
+ newRequire.Module = Module;
+ newRequire.modules = modules;
+ newRequire.cache = cache;
+ newRequire.parent = previousRequire;
+ newRequire.register = function (id, exports) {
+ modules[id] = [
+ function (require, module) {
+ module.exports = exports;
+ },
+ {},
+ ];
+ };
+
+ Object.defineProperty(newRequire, 'root', {
+ get: function () {
+ return globalObject[parcelRequireName];
+ },
+ });
+
+ globalObject[parcelRequireName] = newRequire;
+
+ for (var i = 0; i < entry.length; i++) {
+ newRequire(entry[i]);
+ }
+
+ if (mainEntry) {
+ // Expose entry point to Node, AMD or browser globals
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
+ var mainExports = newRequire(mainEntry);
+
+ // CommonJS
+ if (typeof exports === 'object' && typeof module !== 'undefined') {
+ module.exports = mainExports;
+
+ // RequireJS
+ } else if (typeof define === 'function' && define.amd) {
+ define(function () {
+ return mainExports;
+ });
+
+ //