remove autoHeight option

This commit is contained in:
Harvey committed 2021-12-31 17:56:43 +08:00
1 parent a74c6194be
commit 8404a8c5cd
19 files changed
+61 -78

No files matched your search

@@ -199,23 +199,6 @@ var art = new Artplayer({
});
```
## autoHeight
- Type: `Boolean`
- Default: `false`
When the container has only width, you want the container height adapt to the player aspect ratio.
<div className="run-code">▶ Run Code</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
autoHeight: true,
});
```
## autoMini
- Type: `Boolean`
@@ -652,6 +652,28 @@ art.on('ready', () => {
});
```
## autoHeight
- Type: `Setter/Getter`
- Default: `Boolean`
When the container has only width, you want the container height adapt to the player aspect ratio.
<div className="run-code">▶ Run Code</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
});
art.on('ready', () => {
console.info(art.autoHeight);
art.autoHeight = true;
console.info(art.autoHeight);
});
```
## loop
- Type: `Setter/Getter`
@@ -199,23 +199,6 @@ var art = new Artplayer({
});
```
## autoHeight
- 类型: `Boolean`
- 默认: `false`
当容器只有宽度,但你希望容器高度能自适应播放器的长宽比
<div className="run-code">▶ Run Code</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
autoHeight: true,
});
```
## autoMini
- 类型: `Boolean`
@@ -674,6 +674,28 @@ art.on('ready', () => {
})
```
## autoHeight
- 类型: `Setter/Getter`
- 参数: `Boolean`
当容器只有宽度,但你希望容器高度能自适应播放器的长宽比
<div className="run-code">▶ Run Code</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
});
art.on('ready', () => {
console.info(art.autoHeight);
art.autoHeight = true;
console.info(art.autoHeight);
});
```
:::tip 提示
删除区间循环播放,只需要设置 `loop` 为 `[]` 即可
+2 -2
View File
@@ -1,8 +1,8 @@
/*!
* artplayer.js v4.1.2
* artplayer.js v4.1.3
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2021 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return n(t)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}!function(t,e){void 0===e&&(e={});var r=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}('.art-video-player{zoom:1;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-high-contrast-adjust:none;background-color:#000;color:#eee;direction:ltr;display:flex;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:14px;height:100%;line-height:1.3;margin:0 auto;outline:0;position:relative;text-align:left;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;z-index:20}.art-video-player *{box-sizing:border-box;margin:0;padding:0}.art-video-player ::-webkit-scrollbar{height:5px;width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{align-items:center;display:inline-flex;justify-content:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}}.art-video-player .art-video{background-color:#000;cursor:pointer;z-index:10}.art-video-player .art-poster,.art-video-player .art-video{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.art-video-player .art-poster{background-position:50%;background-repeat:no-repeat;background-size:cover;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:11}.art-video-player .art-subtitle{bottom:10px;color:#fff;display:none;font-size:20px;padding:0 20px;pointer-events:none;position:absolute;text-align:center;text-shadow:.5px .5px .5px rgba(0,0,0,.5);width:100%;z-index:20}.art-video-player .art-subtitle p{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;line-height:1.2;margin:5px 0 0;word-break:break-all}.art-video-player .art-bilingual p:nth-child(n+2){transform:scale(.6);transform-origin:center top}.art-video-player.art-subtitle-show .art-subtitle{display:block}.art-video-player.art-control-show .art-subtitle{bottom:50px}.art-video-player .art-danmuku{z-index:30}.art-video-player .art-danmuku,.art-video-player .art-layers{bottom:0;height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%}.art-video-player .art-layers{display:none;z-index:40}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:block}.art-video-player .art-mask{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%;z-index:50}.art-video-player .art-mask .art-state{align-items:center;bottom:65px;display:flex;height:60px;justify-content:center;opacity:.6;position:absolute;right:30px;width:60px}.art-video-player.art-mask-show .art-mask{display:flex}.art-video-player .art-loading{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;pointer-events:nonLine truncated
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return n(t)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}!function(t,e){void 0===e&&(e={});var r=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}('.art-video-player{zoom:1;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-high-contrast-adjust:none;background-color:#000;color:#eee;direction:ltr;display:flex;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:14px;height:100%;line-height:1.3;margin:0 auto;outline:0;position:relative;text-align:left;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;z-index:20}.art-video-player *{box-sizing:border-box;margin:0;padding:0}.art-video-player ::-webkit-scrollbar{height:5px;width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{align-items:center;display:inline-flex;justify-content:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}}.art-video-player .art-video{background-color:#000;cursor:pointer;z-index:10}.art-video-player .art-poster,.art-video-player .art-video{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.art-video-player .art-poster{background-position:50%;background-repeat:no-repeat;background-size:cover;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:11}.art-video-player .art-subtitle{bottom:10px;color:#fff;display:none;font-size:20px;padding:0 20px;pointer-events:none;position:absolute;text-align:center;text-shadow:.5px .5px .5px rgba(0,0,0,.5);width:100%;z-index:20}.art-video-player .art-subtitle p{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;line-height:1.2;margin:5px 0 0;word-break:break-all}.art-video-player .art-bilingual p:nth-child(n+2){transform:scale(.6);transform-origin:center top}.art-video-player.art-subtitle-show .art-subtitle{display:block}.art-video-player.art-control-show .art-subtitle{bottom:50px}.art-video-player .art-danmuku{z-index:30}.art-video-player .art-danmuku,.art-video-player .art-layers{bottom:0;height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%}.art-video-player .art-layers{display:none;z-index:40}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:block}.art-video-player .art-mask{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%;z-index:50}.art-video-player .art-mask .art-state{align-items:center;bottom:65px;display:flex;height:60px;justify-content:center;opacity:.6;position:absolute;right:30px;width:60px}.art-video-player.art-mask-show .art-mask{display:flex}.art-video-player .art-loading{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;pointer-events:nonLine truncated
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "artplayer",
"version": "4.1.2",
"version": "4.1.3",
"expose": "Artplayer",
"description": "ArtPlayer.js is a modern and full featured HTML5 video player",
"main": "dist/artplayer.js",
@@ -5,7 +5,6 @@ export default function resizeInit(art, events) {
const resizeFn = throttle(() => {
if (player.normalSize) {
player.autoHeight = option.autoHeight;
player.autoSize = option.autoSize;
}
player.aspectRatioReset = true;
-1
View File
@@ -126,7 +126,6 @@ export default class Artplayer extends Emitter {
autoplay: false,
autoSize: false,
autoMini: false,
autoHeight: false,
loop: false,
flip: false,
rotate: false,
@@ -92,7 +92,6 @@ export default function eventInit(art, player) {
// });
art.once('video:loadedmetadata', () => {
player.autoHeight = option.autoHeight;
player.autoSize = option.autoSize;
if (isMobile) {
art.loading.show = false;
@@ -15,7 +15,6 @@ const nativeScreenfull = (art, player) => {
screenfull.request($player).then(() => {
addClass($player, 'art-fullscreen');
player.aspectRatioReset = true;
player.autoHeight = false;
player.autoSize = false;
art.emit('resize');
art.emit('fullscreen', true);
@@ -24,7 +23,6 @@ const nativeScreenfull = (art, player) => {
screenfull.exit().then(() => {
removeClass($player, 'art-fullscreen');
player.aspectRatioReset = true;
player.autoHeight = art.option.autoHeight;
player.autoSize = art.option.autoSize;
art.emit('resize');
art.emit('fullscreen');
@@ -11,14 +11,12 @@ export default function fullscreenWebMix(art, player) {
if (value) {
addClass($player, 'art-fullscreen-web');
player.aspectRatioReset = true;
player.autoHeight = false;
player.autoSize = false;
art.emit('resize');
art.emit('fullscreenWeb', true);
} else {
removeClass($player, 'art-fullscreen-web');
player.aspectRatioReset = true;
player.autoHeight = art.option.autoHeight;
player.autoSize = art.option.autoSize;
art.emit('resize');
art.emit('fullscreenWeb');
-2
View File
@@ -55,7 +55,6 @@ export default function miniMix(art, player) {
},
set(value) {
if (value) {
player.autoHeight = false;
player.autoSize = false;
cacheStyle = $player.style.cssText;
addClass($player, 'art-mini');
@@ -88,7 +87,6 @@ export default function miniMix(art, player) {
setStyle($player, 'left', null);
player.aspectRatio = false;
player.playbackRate = false;
player.autoHeight = option.autoHeight;
player.autoSize = option.autoSize;
art.emit('mini');
}
@@ -12,7 +12,6 @@ export default function switchMix(art, player) {
player.playbackRate = false;
player.aspectRatio = false;
player.flip = 'normal';
player.autoHeight = option.autoHeight;
player.autoSize = option.autoSize;
player.currentTime = currentTime;
art.notice.show = '';
-1
View File
@@ -39,7 +39,6 @@ export default {
autoplay: b,
autoSize: b,
autoMini: b,
autoHeight: b,
loop: b,
flip: b,
rotate: b,
+2 -5
View File
@@ -212,11 +212,6 @@ type Option = {
*/
autoMini?: boolean;
/**
* Set the container height based on the video length aspect ratio and the container width
*/
autoHeight?: boolean;
/**
* Whether video auto loop
*/
@@ -458,6 +453,8 @@ declare class Player {
set rotate(deg: Rotate);
get autoSize(): boolean;
set autoSize(state: boolean);
get autoHeight(): boolean;
set autoHeight(state: boolean);
get currentTime(): number;
set currentTime(time: number);
get duration(): number;