修改d.ts

This commit is contained in:
Harvey Zack committed 2019-04-19 16:39:09 +08:00
1 parent 95bbe6f3b2
commit 94405a7240
4 files changed
+143 -10

No files matched your search

+4 -1
View File
@@ -28,6 +28,10 @@ let id = 0;
class Artplayer extends Emitter {
constructor(option) {
super();
utils.errorHandle(
this instanceof Artplayer,
'Artplayer is a constructor and should be called with the `new` keyword',
);
utils.errorHandle(typeof window.Promise === 'function', "Unsupported 'Promise' method");
this.option = utils.mergeDeep(Artplayer.DEFAULTS, option);
optionValidator(this.option, scheme);
@@ -66,7 +70,6 @@ class Artplayer extends Emitter {
title: '',
theme: '#f00',
volume: 0.7,
isLive: false,
muted: false,
autoplay: false,
autoSize: false,
+137 -7
View File
@@ -1,39 +1,169 @@
export default class Artplayer {
constructor(option: {
/**
* Selector or a dom element (required)
*/
container: string | Element;
url: string;
/**
* Video url or a function that returns a promise value of url (required)
*/
url: string | Function;
/**
* Video cover url
*/
poster?: string;
/**
* Video title
*/
title?: string;
type?: string;
mimeCodec?: string;
/**
* Theme color like: #fff
*/
theme?: string;
lang?: string;
/**
* Display language
*/
lang?: 'en' | 'zh-cn' | 'zh-tw';
/**
* Initialize volume 0 ~ 1, will be overwritten by cached values
*/
volume?: number;
isLive?: boolean;
/**
* Whether to mute by default
*/
muted?: boolean;
/**
* Whether to autoplay by default
*/
autoplay?: boolean;
/**
* Whether to automatically adapt to the size of the container
*/
autoSize?: boolean;
/**
* Whether to loop
*/
loop?: boolean;
/**
* Whether to display playbackRate button
*/
playbackRate?: boolean;
/**
* Whether to display aspectRatio option
*/
aspectRatio?: boolean;
/**
* Whether to display screenshot button
*/
screenshot?: boolean;
/**
* Whether to display setting button
*/
setting?: boolean;
/**
* Whether to use hotkey
*/
hotkey?: boolean;
/**
* Whether to display pip button
*/
pip?: boolean;
/**
* Whether to play mutually exclusive when multiple players
*/
mutex?: boolean;
/**
* Whether to display fullscreen button
*/
fullscreen?: boolean;
/**
* Whether to display web fullscreen button
*/
fullscreenWeb?: boolean;
/**
* Initialize the custom layer
*/
layers?: any[];
/**
* Initialize the custom contextmenu
*/
contextmenu?: any[];
/**
* Initialize the custom quality
*/
quality?: any[];
/**
* Initialize the custom controls
*/
controls?: any[];
/**
* Initialize the custom highlight
*/
highlight?: any[];
/**
* Initialize the custom plugins
*/
plugins?: any[];
/**
* Initialize the custom whitelist
*/
whitelist?: any[];
/**
* Thumbnails option
*/
thumbnails?: object;
subtitle?: object;
/**
* Subtitle option
*/
subtitle?: {
url: string;
style: object;
};
/**
* More video attributes
*/
moreVideoAttr?: object;
icons?: object;
/**
* Custom icon
*/
icons?: {
loading?: string;
playBig?: string;
};
/**
* Custom video type
*/
customType?: object;
});
}