feat: Add support for dynamic thumbnails in Artplayer

The code changes introduce a new `art.thumbnails` property that allows for dynamic setting of thumbnails in Artplayer. This feature enhances the user experience by providing a visual preview of the video content.
This commit is contained in:
Harvey Zack committed 2024-08-15 22:50:21 +08:00
1 parent 5655db4b20
commit 52d9064c8b
10 files changed
+260 -110

No files matched your search

+28 -26
View File
@@ -9,6 +9,33 @@ import Artplayer = require('./artplayer');
export type CustomType = 'flv' | 'm3u8' | 'hls' | 'ts' | 'mpd' | 'torrent' | (string & Record<never, never>);
export type Thumbnails = {
/**
* The thumbnail image url
*/
url: string;
/**
* The thumbnail item number
*/
number?: number;
/**
* The thumbnail column size
*/
column?: number;
/**
* The thumbnail width
*/
width?: number;
/**
* The thumbnail height
*/
height?: number;
};
export type Option = {
/**
* The player id
@@ -228,32 +255,7 @@ export type Option = {
/**
* Custom thumbnail
*/
thumbnails?: {
/**
* The thumbnail image url
*/
url: string;
/**
* The thumbnail item number
*/
number?: number;
/**
* The thumbnail column size
*/
column?: number;
/**
* The thumbnail width
*/
width?: number;
/**
* The thumbnail height
*/
height?: number;
};
thumbnails?: Thumbnails;
/**
* Custom subtitle option
+3 -1
View File
@@ -1,5 +1,5 @@
import { CssVar } from './cssVar';
import { CustomType } from './option';
import { CustomType, Thumbnails } from './option';
import { quality } from './quality';
export type AspectRatio = 'default' | '4:3' | '16:9' | (`${number}:${number}` & Record<never, never>);
@@ -63,6 +63,8 @@ export declare class Player {
set subtitleOffset(time: number);
set switch(url: string);
set quality(quality: quality[]);
get thumbnails(): Thumbnails;
set thumbnails(thumbnails: Thumbnails);
pause(): void;
play(): Promise<void>;
toggle(): void;