diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css index 706218333..ab6e019ac 100644 --- a/docs/assets/css/style.css +++ b/docs/assets/css/style.css @@ -125,7 +125,7 @@ img { z-index: 9; top: 45px; left: 0; - width: 200px; + width: 250px; padding: 0 10px; background: #2b2b2b; } diff --git a/docs/assets/example/vtt.thumbnail.js b/docs/assets/example/vtt.thumbnail.js new file mode 100644 index 000000000..1de6bd64a --- /dev/null +++ b/docs/assets/example/vtt.thumbnail.js @@ -0,0 +1,9 @@ +var art = new Artplayer({ + container: '.artplayer-app', + url: '/assets/sample/bbb-video.mp4', + plugins: [ + artplayerPluginVttThumbnail({ + vtt: '/assets/sample/bbb-thumbnails.vtt', + }) + ] +}); \ No newline at end of file diff --git a/docs/assets/img/bbb-sprite.jpg b/docs/assets/sample/bbb-sprite.jpg similarity index 100% rename from docs/assets/img/bbb-sprite.jpg rename to docs/assets/sample/bbb-sprite.jpg diff --git a/docs/assets/sample/bbb-thumbnails.vtt b/docs/assets/sample/bbb-thumbnails.vtt index ed4941fc4..e8f38a2f5 100644 --- a/docs/assets/sample/bbb-thumbnails.vtt +++ b/docs/assets/sample/bbb-thumbnails.vtt @@ -1,361 +1,361 @@ WEBVTT 00:00.000 --> 00:05.000 -../img/bbb-sprite.jpg#xywh=0,0,128,72 +bbb-sprite.jpg#xywh=0,0,128,72 00:05.000 --> 00:10.000 -../img/bbb-sprite.jpg#xywh=128,0,128,72 +bbb-sprite.jpg#xywh=128,0,128,72 00:10.000 --> 00:15.000 -../img/bbb-sprite.jpg#xywh=256,0,128,72 +bbb-sprite.jpg#xywh=256,0,128,72 00:15.000 --> 00:20.000 -../img/bbb-sprite.jpg#xywh=384,0,128,72 +bbb-sprite.jpg#xywh=384,0,128,72 00:20.000 --> 00:25.000 -../img/bbb-sprite.jpg#xywh=512,0,128,72 +bbb-sprite.jpg#xywh=512,0,128,72 00:25.000 --> 00:30.000 -../img/bbb-sprite.jpg#xywh=640,0,128,72 +bbb-sprite.jpg#xywh=640,0,128,72 00:30.000 --> 00:35.000 -../img/bbb-sprite.jpg#xywh=768,0,128,72 +bbb-sprite.jpg#xywh=768,0,128,72 00:35.000 --> 00:40.000 -../img/bbb-sprite.jpg#xywh=896,0,128,72 +bbb-sprite.jpg#xywh=896,0,128,72 00:40.000 --> 00:45.000 -../img/bbb-sprite.jpg#xywh=1024,0,128,72 +bbb-sprite.jpg#xywh=1024,0,128,72 00:45.000 --> 00:50.000 -../img/bbb-sprite.jpg#xywh=1152,0,128,72 +bbb-sprite.jpg#xywh=1152,0,128,72 00:50.000 --> 00:55.000 -../img/bbb-sprite.jpg#xywh=1280,0,128,72 +bbb-sprite.jpg#xywh=1280,0,128,72 00:55.000 --> 01:00.000 -../img/bbb-sprite.jpg#xywh=0,72,128,72 +bbb-sprite.jpg#xywh=0,72,128,72 01:00.000 --> 01:05.000 -../img/bbb-sprite.jpg#xywh=128,72,128,72 +bbb-sprite.jpg#xywh=128,72,128,72 01:05.000 --> 01:10.000 -../img/bbb-sprite.jpg#xywh=256,72,128,72 +bbb-sprite.jpg#xywh=256,72,128,72 01:10.000 --> 01:15.000 -../img/bbb-sprite.jpg#xywh=384,72,128,72 +bbb-sprite.jpg#xywh=384,72,128,72 01:15.000 --> 01:20.000 -../img/bbb-sprite.jpg#xywh=512,72,128,72 +bbb-sprite.jpg#xywh=512,72,128,72 01:20.000 --> 01:25.000 -../img/bbb-sprite.jpg#xywh=640,72,128,72 +bbb-sprite.jpg#xywh=640,72,128,72 01:25.000 --> 01:30.000 -../img/bbb-sprite.jpg#xywh=768,72,128,72 +bbb-sprite.jpg#xywh=768,72,128,72 01:30.000 --> 01:35.000 -../img/bbb-sprite.jpg#xywh=896,72,128,72 +bbb-sprite.jpg#xywh=896,72,128,72 01:35.000 --> 01:40.000 -../img/bbb-sprite.jpg#xywh=1024,72,128,72 +bbb-sprite.jpg#xywh=1024,72,128,72 01:40.000 --> 01:45.000 -../img/bbb-sprite.jpg#xywh=1152,72,128,72 +bbb-sprite.jpg#xywh=1152,72,128,72 01:45.000 --> 01:50.000 -../img/bbb-sprite.jpg#xywh=1280,72,128,72 +bbb-sprite.jpg#xywh=1280,72,128,72 01:50.000 --> 01:55.000 -../img/bbb-sprite.jpg#xywh=0,144,128,72 +bbb-sprite.jpg#xywh=0,144,128,72 01:55.000 --> 02:00.000 -../img/bbb-sprite.jpg#xywh=128,144,128,72 +bbb-sprite.jpg#xywh=128,144,128,72 02:00.000 --> 02:05.000 -../img/bbb-sprite.jpg#xywh=256,144,128,72 +bbb-sprite.jpg#xywh=256,144,128,72 02:05.000 --> 02:10.000 -../img/bbb-sprite.jpg#xywh=384,144,128,72 +bbb-sprite.jpg#xywh=384,144,128,72 02:10.000 --> 02:15.000 -../img/bbb-sprite.jpg#xywh=512,144,128,72 +bbb-sprite.jpg#xywh=512,144,128,72 02:15.000 --> 02:20.000 -../img/bbb-sprite.jpg#xywh=640,144,128,72 +bbb-sprite.jpg#xywh=640,144,128,72 02:20.000 --> 02:25.000 -../img/bbb-sprite.jpg#xywh=768,144,128,72 +bbb-sprite.jpg#xywh=768,144,128,72 02:25.000 --> 02:30.000 -../img/bbb-sprite.jpg#xywh=896,144,128,72 +bbb-sprite.jpg#xywh=896,144,128,72 02:30.000 --> 02:35.000 -../img/bbb-sprite.jpg#xywh=1024,144,128,72 +bbb-sprite.jpg#xywh=1024,144,128,72 02:35.000 --> 02:40.000 -../img/bbb-sprite.jpg#xywh=1152,144,128,72 +bbb-sprite.jpg#xywh=1152,144,128,72 02:40.000 --> 02:45.000 -../img/bbb-sprite.jpg#xywh=1280,144,128,72 +bbb-sprite.jpg#xywh=1280,144,128,72 02:45.000 --> 02:50.000 -../img/bbb-sprite.jpg#xywh=0,216,128,72 +bbb-sprite.jpg#xywh=0,216,128,72 02:50.000 --> 02:55.000 -../img/bbb-sprite.jpg#xywh=128,216,128,72 +bbb-sprite.jpg#xywh=128,216,128,72 02:55.000 --> 03:00.000 -../img/bbb-sprite.jpg#xywh=256,216,128,72 +bbb-sprite.jpg#xywh=256,216,128,72 03:00.000 --> 03:05.000 -../img/bbb-sprite.jpg#xywh=384,216,128,72 +bbb-sprite.jpg#xywh=384,216,128,72 03:05.000 --> 03:10.000 -../img/bbb-sprite.jpg#xywh=512,216,128,72 +bbb-sprite.jpg#xywh=512,216,128,72 03:10.000 --> 03:15.000 -../img/bbb-sprite.jpg#xywh=640,216,128,72 +bbb-sprite.jpg#xywh=640,216,128,72 03:15.000 --> 03:20.000 -../img/bbb-sprite.jpg#xywh=768,216,128,72 +bbb-sprite.jpg#xywh=768,216,128,72 03:20.000 --> 03:25.000 -../img/bbb-sprite.jpg#xywh=896,216,128,72 +bbb-sprite.jpg#xywh=896,216,128,72 03:25.000 --> 03:30.000 -../img/bbb-sprite.jpg#xywh=1024,216,128,72 +bbb-sprite.jpg#xywh=1024,216,128,72 03:30.000 --> 03:35.000 -../img/bbb-sprite.jpg#xywh=1152,216,128,72 +bbb-sprite.jpg#xywh=1152,216,128,72 03:35.000 --> 03:40.000 -../img/bbb-sprite.jpg#xywh=1280,216,128,72 +bbb-sprite.jpg#xywh=1280,216,128,72 03:40.000 --> 03:45.000 -../img/bbb-sprite.jpg#xywh=0,288,128,72 +bbb-sprite.jpg#xywh=0,288,128,72 03:45.000 --> 03:50.000 -../img/bbb-sprite.jpg#xywh=128,288,128,72 +bbb-sprite.jpg#xywh=128,288,128,72 03:50.000 --> 03:55.000 -../img/bbb-sprite.jpg#xywh=256,288,128,72 +bbb-sprite.jpg#xywh=256,288,128,72 03:55.000 --> 04:00.000 -../img/bbb-sprite.jpg#xywh=384,288,128,72 +bbb-sprite.jpg#xywh=384,288,128,72 04:00.000 --> 04:05.000 -../img/bbb-sprite.jpg#xywh=512,288,128,72 +bbb-sprite.jpg#xywh=512,288,128,72 04:05.000 --> 04:10.000 -../img/bbb-sprite.jpg#xywh=640,288,128,72 +bbb-sprite.jpg#xywh=640,288,128,72 04:10.000 --> 04:15.000 -../img/bbb-sprite.jpg#xywh=768,288,128,72 +bbb-sprite.jpg#xywh=768,288,128,72 04:15.000 --> 04:20.000 -../img/bbb-sprite.jpg#xywh=896,288,128,72 +bbb-sprite.jpg#xywh=896,288,128,72 04:20.000 --> 04:25.000 -../img/bbb-sprite.jpg#xywh=1024,288,128,72 +bbb-sprite.jpg#xywh=1024,288,128,72 04:25.000 --> 04:30.000 -../img/bbb-sprite.jpg#xywh=1152,288,128,72 +bbb-sprite.jpg#xywh=1152,288,128,72 04:30.000 --> 04:35.000 -../img/bbb-sprite.jpg#xywh=1280,288,128,72 +bbb-sprite.jpg#xywh=1280,288,128,72 04:35.000 --> 04:40.000 -../img/bbb-sprite.jpg#xywh=0,360,128,72 +bbb-sprite.jpg#xywh=0,360,128,72 04:40.000 --> 04:45.000 -../img/bbb-sprite.jpg#xywh=128,360,128,72 +bbb-sprite.jpg#xywh=128,360,128,72 04:45.000 --> 04:50.000 -../img/bbb-sprite.jpg#xywh=256,360,128,72 +bbb-sprite.jpg#xywh=256,360,128,72 04:50.000 --> 04:55.000 -../img/bbb-sprite.jpg#xywh=384,360,128,72 +bbb-sprite.jpg#xywh=384,360,128,72 04:55.000 --> 05:00.000 -../img/bbb-sprite.jpg#xywh=512,360,128,72 +bbb-sprite.jpg#xywh=512,360,128,72 05:00.000 --> 05:05.000 -../img/bbb-sprite.jpg#xywh=640,360,128,72 +bbb-sprite.jpg#xywh=640,360,128,72 05:05.000 --> 05:10.000 -../img/bbb-sprite.jpg#xywh=768,360,128,72 +bbb-sprite.jpg#xywh=768,360,128,72 05:10.000 --> 05:15.000 -../img/bbb-sprite.jpg#xywh=896,360,128,72 +bbb-sprite.jpg#xywh=896,360,128,72 05:15.000 --> 05:20.000 -../img/bbb-sprite.jpg#xywh=1024,360,128,72 +bbb-sprite.jpg#xywh=1024,360,128,72 05:20.000 --> 05:25.000 -../img/bbb-sprite.jpg#xywh=1152,360,128,72 +bbb-sprite.jpg#xywh=1152,360,128,72 05:25.000 --> 05:30.000 -../img/bbb-sprite.jpg#xywh=1280,360,128,72 +bbb-sprite.jpg#xywh=1280,360,128,72 05:30.000 --> 05:35.000 -../img/bbb-sprite.jpg#xywh=0,432,128,72 +bbb-sprite.jpg#xywh=0,432,128,72 05:35.000 --> 05:40.000 -../img/bbb-sprite.jpg#xywh=128,432,128,72 +bbb-sprite.jpg#xywh=128,432,128,72 05:40.000 --> 05:45.000 -../img/bbb-sprite.jpg#xywh=256,432,128,72 +bbb-sprite.jpg#xywh=256,432,128,72 05:45.000 --> 05:50.000 -../img/bbb-sprite.jpg#xywh=384,432,128,72 +bbb-sprite.jpg#xywh=384,432,128,72 05:50.000 --> 05:55.000 -../img/bbb-sprite.jpg#xywh=512,432,128,72 +bbb-sprite.jpg#xywh=512,432,128,72 05:55.000 --> 06:00.000 -../img/bbb-sprite.jpg#xywh=640,432,128,72 +bbb-sprite.jpg#xywh=640,432,128,72 06:00.000 --> 06:05.000 -../img/bbb-sprite.jpg#xywh=768,432,128,72 +bbb-sprite.jpg#xywh=768,432,128,72 06:05.000 --> 06:10.000 -../img/bbb-sprite.jpg#xywh=896,432,128,72 +bbb-sprite.jpg#xywh=896,432,128,72 06:10.000 --> 06:15.000 -../img/bbb-sprite.jpg#xywh=1024,432,128,72 +bbb-sprite.jpg#xywh=1024,432,128,72 06:15.000 --> 06:20.000 -../img/bbb-sprite.jpg#xywh=1152,432,128,72 +bbb-sprite.jpg#xywh=1152,432,128,72 06:20.000 --> 06:25.000 -../img/bbb-sprite.jpg#xywh=1280,432,128,72 +bbb-sprite.jpg#xywh=1280,432,128,72 06:25.000 --> 06:30.000 -../img/bbb-sprite.jpg#xywh=0,504,128,72 +bbb-sprite.jpg#xywh=0,504,128,72 06:30.000 --> 06:35.000 -../img/bbb-sprite.jpg#xywh=128,504,128,72 +bbb-sprite.jpg#xywh=128,504,128,72 06:35.000 --> 06:40.000 -../img/bbb-sprite.jpg#xywh=256,504,128,72 +bbb-sprite.jpg#xywh=256,504,128,72 06:40.000 --> 06:45.000 -../img/bbb-sprite.jpg#xywh=384,504,128,72 +bbb-sprite.jpg#xywh=384,504,128,72 06:45.000 --> 06:50.000 -../img/bbb-sprite.jpg#xywh=512,504,128,72 +bbb-sprite.jpg#xywh=512,504,128,72 06:50.000 --> 06:55.000 -../img/bbb-sprite.jpg#xywh=640,504,128,72 +bbb-sprite.jpg#xywh=640,504,128,72 06:55.000 --> 07:00.000 -../img/bbb-sprite.jpg#xywh=768,504,128,72 +bbb-sprite.jpg#xywh=768,504,128,72 07:00.000 --> 07:05.000 -../img/bbb-sprite.jpg#xywh=896,504,128,72 +bbb-sprite.jpg#xywh=896,504,128,72 07:05.000 --> 07:10.000 -../img/bbb-sprite.jpg#xywh=1024,504,128,72 +bbb-sprite.jpg#xywh=1024,504,128,72 07:10.000 --> 07:15.000 -../img/bbb-sprite.jpg#xywh=1152,504,128,72 +bbb-sprite.jpg#xywh=1152,504,128,72 07:15.000 --> 07:20.000 -../img/bbb-sprite.jpg#xywh=1280,504,128,72 +bbb-sprite.jpg#xywh=1280,504,128,72 07:20.000 --> 07:25.000 -../img/bbb-sprite.jpg#xywh=0,576,128,72 +bbb-sprite.jpg#xywh=0,576,128,72 07:25.000 --> 07:30.000 -../img/bbb-sprite.jpg#xywh=128,576,128,72 +bbb-sprite.jpg#xywh=128,576,128,72 07:30.000 --> 07:35.000 -../img/bbb-sprite.jpg#xywh=256,576,128,72 +bbb-sprite.jpg#xywh=256,576,128,72 07:35.000 --> 07:40.000 -../img/bbb-sprite.jpg#xywh=384,576,128,72 +bbb-sprite.jpg#xywh=384,576,128,72 07:40.000 --> 07:45.000 -../img/bbb-sprite.jpg#xywh=512,576,128,72 +bbb-sprite.jpg#xywh=512,576,128,72 07:45.000 --> 07:50.000 -../img/bbb-sprite.jpg#xywh=640,576,128,72 +bbb-sprite.jpg#xywh=640,576,128,72 07:50.000 --> 07:55.000 -../img/bbb-sprite.jpg#xywh=768,576,128,72 +bbb-sprite.jpg#xywh=768,576,128,72 07:55.000 --> 08:00.000 -../img/bbb-sprite.jpg#xywh=896,576,128,72 +bbb-sprite.jpg#xywh=896,576,128,72 08:00.000 --> 08:05.000 -../img/bbb-sprite.jpg#xywh=1024,576,128,72 +bbb-sprite.jpg#xywh=1024,576,128,72 08:05.000 --> 08:10.000 -../img/bbb-sprite.jpg#xywh=1152,576,128,72 +bbb-sprite.jpg#xywh=1152,576,128,72 08:10.000 --> 08:15.000 -../img/bbb-sprite.jpg#xywh=1280,576,128,72 +bbb-sprite.jpg#xywh=1280,576,128,72 08:15.000 --> 08:20.000 -../img/bbb-sprite.jpg#xywh=0,648,128,72 +bbb-sprite.jpg#xywh=0,648,128,72 08:20.000 --> 08:25.000 -../img/bbb-sprite.jpg#xywh=128,648,128,72 +bbb-sprite.jpg#xywh=128,648,128,72 08:25.000 --> 08:30.000 -../img/bbb-sprite.jpg#xywh=256,648,128,72 +bbb-sprite.jpg#xywh=256,648,128,72 08:30.000 --> 08:35.000 -../img/bbb-sprite.jpg#xywh=384,648,128,72 +bbb-sprite.jpg#xywh=384,648,128,72 08:35.000 --> 08:40.000 -../img/bbb-sprite.jpg#xywh=512,648,128,72 +bbb-sprite.jpg#xywh=512,648,128,72 08:40.000 --> 08:45.000 -../img/bbb-sprite.jpg#xywh=640,648,128,72 +bbb-sprite.jpg#xywh=640,648,128,72 08:45.000 --> 08:50.000 -../img/bbb-sprite.jpg#xywh=768,648,128,72 +bbb-sprite.jpg#xywh=768,648,128,72 08:50.000 --> 08:55.000 -../img/bbb-sprite.jpg#xywh=896,648,128,72 +bbb-sprite.jpg#xywh=896,648,128,72 08:55.000 --> 09:00.000 -../img/bbb-sprite.jpg#xywh=1024,648,128,72 +bbb-sprite.jpg#xywh=1024,648,128,72 09:00.000 --> 09:05.000 -../img/bbb-sprite.jpg#xywh=1152,648,128,72 +bbb-sprite.jpg#xywh=1152,648,128,72 09:05.000 --> 09:10.000 -../img/bbb-sprite.jpg#xywh=1280,648,128,72 +bbb-sprite.jpg#xywh=1280,648,128,72 09:10.000 --> 09:15.000 -../img/bbb-sprite.jpg#xywh=0,720,128,72 +bbb-sprite.jpg#xywh=0,720,128,72 09:15.000 --> 09:20.000 -../img/bbb-sprite.jpg#xywh=128,720,128,72 +bbb-sprite.jpg#xywh=128,720,128,72 09:20.000 --> 09:25.000 -../img/bbb-sprite.jpg#xywh=256,720,128,72 +bbb-sprite.jpg#xywh=256,720,128,72 09:25.000 --> 09:30.000 -../img/bbb-sprite.jpg#xywh=384,720,128,72 +bbb-sprite.jpg#xywh=384,720,128,72 09:30.000 --> 09:35.000 -../img/bbb-sprite.jpg#xywh=512,720,128,72 +bbb-sprite.jpg#xywh=512,720,128,72 09:35.000 --> 09:40.000 -../img/bbb-sprite.jpg#xywh=640,720,128,72 +bbb-sprite.jpg#xywh=640,720,128,72 09:40.000 --> 09:45.000 -../img/bbb-sprite.jpg#xywh=768,720,128,72 +bbb-sprite.jpg#xywh=768,720,128,72 09:45.000 --> 09:50.000 -../img/bbb-sprite.jpg#xywh=896,720,128,72 +bbb-sprite.jpg#xywh=896,720,128,72 09:50.000 --> 09:55.000 -../img/bbb-sprite.jpg#xywh=1024,720,128,72 +bbb-sprite.jpg#xywh=1024,720,128,72 09:55.000 --> 10:00.000 -../img/bbb-sprite.jpg#xywh=1152,720,128,72 +bbb-sprite.jpg#xywh=1152,720,128,72 diff --git a/docs/assets/sample/bbb-video.mp4 b/docs/assets/sample/bbb-video.mp4 new file mode 100644 index 000000000..8ed196866 Binary files /dev/null and b/docs/assets/sample/bbb-video.mp4 differ diff --git a/docs/compiled/artplayer-plugin-vtt-thumbnail.js b/docs/compiled/artplayer-plugin-vtt-thumbnail.js new file mode 100644 index 000000000..8467ad2b1 --- /dev/null +++ b/docs/compiled/artplayer-plugin-vtt-thumbnail.js @@ -0,0 +1,7 @@ +/*! + * artplayer-plugin-vtt-thumbnail.js v1.0.0 + * Github: https://github.com/zhw2590582/ArtPlayer + * (c) 2017-2023 Harvey Zack + * Released under the MIT License. + */ +!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(l)return l(t,!0);if(s&&"string"==typeof t)return s(t);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=l,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return i[r]}}),i[r]=f;for(var a=0;a{const{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await(0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",(async i=>{n(e,"display","block");const{second:l,width:s}=function(e,t){const{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth);return{width:i,second:i/n.clientWidth*e.duration}}(t,i),f=u.find((e=>l>=e.start&&l<=e.end));if(!f)return n(e,"display","none");n(e,"backgroundImage",`url(${f.url})`),n(e,"height",`${f.h}px`),n(e,"width",`${f.w}px`),n(e,"backgroundPosition",`-${f.x}px -${f.y}px`),s<=f.w/2?n(e,"left",0):s>o.clientWidth-f.w/2?n(e,"left",o.clientWidth-f.w+"px"):n(e,"left",s-f.w/2+"px")})),l(o,"mouseleave",(()=>{n(e,"display","none")})),t.on("hover",(t=>{n(e,"display",t?"block":"none")}))}}),{name:"artplayerPluginVttThumbnail"}}}n.default=l,l.env="production",l.version="1.0.0",l.build="2023-01-14 14:41:14","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){function r(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=(t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))),u=Number(l)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+u}e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=async function(e=""){const t=(await(await fetch(e)).text()).split(/[\n\r]/gm).filter((e=>e.trim())),n=[];for(let o=1;o ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,s=i.match(u),f=/(.*)#(\w{4})=(.*)/i,a=l.match(f),c=Math.floor(r(s[1])),d=Math.floor(r(s[2])),p=e.split("/");p.pop(),p.push(a[1]);const h={start:c,end:d,url:p.join("/")},m=a[2].split(""),g=a[3].split(",");for(let e=0;e{const{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await(0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",(async i=>{n(e,"display","block");const{second:l,width:f}=function(e,t){const{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth);return{width:i,second:i/n.clientWidth*e.duration}}(t,i),s=u.find((e=>l>=e.start&&l<=e.end));if(!s)return n(e,"display","none");n(e,"backgroundImage",`url(${s.url})`),n(e,"height",`${s.h}px`),n(e,"width",`${s.w}px`),n(e,"backgroundPosition",`-${s.x}px -${s.y}px`),f<=s.w/2?n(e,"left",0):f>o.clientWidth-s.w/2?n(e,"left",o.clientWidth-s.w+"px"):n(e,"left",f-s.w/2+"px")})),l(o,"mouseleave",(()=>{n(e,"display","none")})),t.on("hover",(t=>{n(e,"display",t?"block":"none")}))}}),{name:"artplayerPluginVttThumbnail"}}}n.default=l,l.env="production",l.version="1.0.0",l.build="2023-01-14 14:41:16","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"5fcbX","@parcel/transformer-js/src/esmodule-helpers.js":"47PTV"}],"5fcbX":[function(e,t,n){function r(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=(t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))),u=Number(l)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+u}e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=async function(e=""){const t=(await(await fetch(e)).text()).split(/[\n\r]/gm).filter((e=>e.trim())),n=[];for(let o=1;o ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,f=i.match(u),s=/(.*)#(\w{4})=(.*)/i,a=l.match(s),c=Math.floor(r(f[1])),d=Math.floor(r(f[2])),p=e.split("/");p.pop(),p.push(a[1]);const h={start:c,end:d,url:p.join("/")},m=a[2].split(""),g=a[3].split(",");for(let e=0;eartplayer-plugin-hls-quality +
  • + artplayer-plugin-vtt-thumbnail +
    • Tools
    • diff --git a/docs/uncompiled/artplayer-plugin-vtt-thumbnail/index.js b/docs/uncompiled/artplayer-plugin-vtt-thumbnail/index.js new file mode 100644 index 000000000..bdca95aa1 --- /dev/null +++ b/docs/uncompiled/artplayer-plugin-vtt-thumbnail/index.js @@ -0,0 +1,287 @@ +// 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; + }); + + //