add art.type

This commit is contained in:
Harvey committed 2022-10-21 11:29:25 +08:00
1 parent 31a2a29871
commit f0e856093e
53 files changed
+226 -146

No files matched your search

@@ -721,6 +721,28 @@ art.on('ready', () => {
});
```
## type
- Type: `Setter/Getter`
- Parameter: `String`
Dynamic get and set video type
<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.type);
art.type = 'm3u8';
console.info(art.type);
});
```
## theme
- Type: `Setter/Getter`
@@ -721,6 +721,28 @@ art.on('ready', () => {
});
```
## type
- 类型: `Setter/Getter`
- 参数: `String`
动态获取和设置视频类型
<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.type);
art.type = 'm3u8';
console.info(art.type);
});
```
## theme
- 类型: `Setter/Getter`
+2
View File
@@ -26,6 +26,7 @@ import posterMix from './posterMix';
import autoHeightMix from './autoHeightMix';
import themeMix from './themeMix';
import titleMix from './titleMix';
import typeMix from './typeMix';
import normalSizeMix from './normalSizeMix';
import subtitleOffsetMix from './subtitleOffsetMix';
import airplayMix from './airplayMix';
@@ -62,6 +63,7 @@ export default class Player {
autoHeightMix(art);
themeMix(art);
titleMix(art);
typeMix(art);
normalSizeMix(art);
subtitleOffsetMix(art);
airplayMix(art);
+12
View File
@@ -0,0 +1,12 @@
import { def } from '../utils';
export default function typeMix(art) {
def(art, 'type', {
get() {
return art.option.type;
},
set(type) {
art.option.type = type;
},
});
}