UNPKG

@kwai-video-team/kwai-player-web

Version:

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

1,893 lines (1,800 loc) 109 kB
import { EventEmitter } from 'events'; import * as React_2 from 'react'; /** * @public */ declare type AACPrivPayload = { id: number; checkSum: number; data: Uint8Array; }; /** * @public */ declare type AACPrivReportData = { payload: AACPrivPayload[]; /** 流时间,ms */ streamTimestamp?: number; /** 播放时间,ms */ time?: number; } & SampleExtraDataBasic; /** * @public */ declare type AbrConfig = { defaultSpts: number; bitrate?: number; liveAdaptiveConfig?: LiveAdaptiveConfig; hlsAdaptiveConfig?: HlsAdaptiveConfig; abrSpeedTest: boolean; liveShiftDelaySec: number; liveDelayFragNum: number; }; /** * @public */ declare class AbstractDestroyable implements IDestroyable { /* Excluded from this release type: _destroyableList */ destroy(): void; } export declare type ActionOnReady = 'play' | 'pause'; /** * @public */ declare type AudioTrackInfo = { lang?: string; qualityLabel: string; qualityType: string; bitrate: number; groupId: string; }; /** * @public */ declare type AutoPlaybackRateConfig = { startDelay: number; interval: number; rule: { rate: number; lower: number; upper: number; }[]; }; /** * Chromaticity coordinates of the source primaries. * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. * @public */ declare enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, AVCOL_PRI_BT709 = 1,// /< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, AVCOL_PRI_BT470M = 4,// /< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_PRI_BT470BG = 5,// /< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM AVCOL_PRI_SMPTE170M = 6,// /< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC AVCOL_PRI_SMPTE240M = 7,// /< functionally identical to above AVCOL_PRI_FILM = 8,// /< colour filters using Illuminant C AVCOL_PRI_BT2020 = 9,// /< ITU-R BT2020 AVCOL_PRI_SMPTE428 = 10,// /< SMPTE ST 428-1 (CIE 1931 XYZ) AVCOL_PRI_SMPTEST428_1 = 10, AVCOL_PRI_SMPTE431 = 11,// /< SMPTE ST 431-2 (2011) / DCI P3 AVCOL_PRI_SMPTE432 = 12,// /< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 AVCOL_PRI_EBU3213 = 22,// /< EBU Tech. 3213-E / JEDEC P22 phosphors AVCOL_PRI_JEDEC_P22 = 22, AVCOL_PRI_NB = 23 } /** * @public */ declare enum AVColorRange { AVCOL_RANGE_UNSPECIFIED = 0, AVCOL_RANGE_MPEG = 1, AVCOL_RANGE_JPEG = 2 } /** * YUV colorspace type. * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. * @public */ declare enum AVColorSpace { AVCOL_SPC_RGB = 0,// /< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) AVCOL_SPC_BT709 = 1,// /< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B AVCOL_SPC_UNSPECIFIED = 2, AVCOL_SPC_RESERVED = 3, AVCOL_SPC_FCC = 4,// /< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_SPC_BT470BG = 5,// /< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 AVCOL_SPC_SMPTE170M = 6,// /< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC AVCOL_SPC_SMPTE240M = 7,// /< functionally identical to above AVCOL_SPC_YCGCO = 8,// /< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 AVCOL_SPC_YCOCG = 8, AVCOL_SPC_BT2020_NCL = 9,// /< ITU-R BT2020 non-constant luminance system AVCOL_SPC_BT2020_CL = 10,// /< ITU-R BT2020 constant luminance system AVCOL_SPC_SMPTE2085 = 11,// /< SMPTE 2085, Y'D'zD'x AVCOL_SPC_CHROMA_DERIVED_NCL = 12,// /< Chromaticity-derived non-constant luminance system AVCOL_SPC_CHROMA_DERIVED_CL = 13,// /< Chromaticity-derived constant luminance system AVCOL_SPC_ICTCP = 14,// /< ITU-R BT.2100-0, ICtCp AVCOL_SPC_NB = 15 } /** * Color Transfer Characteristic. * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. * @public */ declare enum AVColorTransferCharacteristic { AVCOL_TRC_RESERVED0 = 0, AVCOL_TRC_BT709 = 1,// /< also ITU-R BT1361 AVCOL_TRC_UNSPECIFIED = 2, AVCOL_TRC_RESERVED = 3, AVCOL_TRC_GAMMA22 = 4,// /< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM AVCOL_TRC_GAMMA28 = 5,// /< also ITU-R BT470BG AVCOL_TRC_SMPTE170M = 6,// /< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC AVCOL_TRC_SMPTE240M = 7, AVCOL_TRC_LINEAR = 8,// /< "Linear transfer characteristics" AVCOL_TRC_LOG = 9,// /< "Logarithmic transfer characteristic (100:1 range)" AVCOL_TRC_LOG_SQRT = 10,// /< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" AVCOL_TRC_IEC61966_2_4 = 11,// /< IEC 61966-2-4 AVCOL_TRC_BT1361_ECG = 12,// /< ITU-R BT1361 Extended Colour Gamut AVCOL_TRC_IEC61966_2_1 = 13,// /< IEC 61966-2-1 (sRGB or sYCC) AVCOL_TRC_BT2020_10 = 14,// /< ITU-R BT2020 for 10-bit system AVCOL_TRC_BT2020_12 = 15,// /< ITU-R BT2020 for 12-bit system AVCOL_TRC_SMPTE2084 = 16,// /< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems AVCOL_TRC_SMPTEST2084 = 16, AVCOL_TRC_SMPTE428 = 17,// /< SMPTE ST 428-1 AVCOL_TRC_SMPTEST428_1 = 17, AVCOL_TRC_ARIB_STD_B67 = 18,// /< ARIB STD-B67, known as "Hybrid log-gamma" AVCOL_TRC_NB = 19 } /** * @public */ declare type BaseConfig = { isLive?: boolean; box?: MediaBox; src?: InputMediaDescription; nativeFirst?: boolean; credentials: boolean; startPlayBufferSec: number; adaptive: boolean; startFrom?: number; startFromKeyframe: boolean; resourceBuffer: boolean; resourceBufferSize: number; baseURL?: string; appendErrorMaxRetry: number; alwaysSeekKeyframe: boolean; liveShiftType: LiveShiftType_2; forceRenderOnSeekEnd?: boolean; playbackAbilityCacheTimeout: number; } & LiveConfig & LoadConfig & LogConfig; /** * @public */ declare type BaseLevelEventData = { level: number; }; /** * @public */ declare type BaseLoaderConfig = { preprocessUrl?: PreprocessURL; preferNativeLoader?: boolean; }; /** * 基础媒体描述,可以输入url、File或者快手私有Manifest * @public */ declare type BaseMediaDescription = string | Blob | KwaiManifest | FlvAbrManifest | FlvMultipartManifest | HLSManifest; /** * @public */ declare type BaseSEIPayload = { type: number; data: Uint8Array; }; /** * @public */ declare type BasicEventData = { /* Excluded from this release type: preventFollowUp */ }; /** * @public */ export declare type BizData = { resourceId?: string | number; userId?: string | number; photoId?: string; activityTag?: string; request?: { header: Record<string, any>; }; secretId?: string; secretKey?: string; isVip?: boolean | number; } & Record<string, unknown>; export declare class CallbackProxy { private _callbacks; add(cb: (params: unknown) => void): void; remove(cb: (params: unknown) => void): void; call(params: unknown): void; destroy(): void; } /** * @public */ declare enum CanvasContextType { /** * HDR渲染颜色不对,已知问题。 */ canvas2d = "canvas2d", webgl = "webgl" } /** * @public */ declare enum CodecType { unknown = "unknown", h264 = "h264", hevc = "hevc", av1 = "av1", kvc3 = "kvc3", kvc4 = "kvc4", kvc5 = "kvc5", kvc6 = "kvc6", aac = "aac", mp3 = "mp3", opus = "opus", yuv = "yuv", rawvideo = "rawvideo", vvc = "vvc", bvc2 = "bvc2", kvc30 = "kvc30" } /** * @public */ declare type ColorInfo = { colorRange: AVColorRange; colourPrimaries: AVColorPrimaries; transferCharacteristics: AVColorTransferCharacteristic; matrixCoefficients: AVColorSpace; }; /** * @public * 控制条的多语言key */ export declare enum ControlsLangDictKey { PLAY = "play", PAUSE = "pause", REFRESH = "refresh", NEXT = "next", TURN_ON_LOOP = "turnOnLoop", TURN_OFF_LOOP = "turnOffLoop", LOOP = "loop", PLAYBACK_RATE_NORMAL = "playbackRateNromal", OPTIONS = "options", DOWNLOAD = "download", VIDEO_TRACK = "videoTrack", AUDIO_TRACK = "audioTrack", PLAYBACK_RATE = "playbackRate", PLAYBACK_RATE_SHORT = "playbackRateShort", PICTURE_IN_PICTURE = "pictureInPicture", EXIT_PICTURE_IN_PICTURE = "exitPictureInPicture", PLAY_INFO = "playInfo", MIRROR_IMAGE = "mirrorImage", ROTATE = "rotate", FULLSCREEN = "fullscreen", EXIT_FULLSCREEN = "exitFullscreen", WINDOW_FULLSCREEN = "windowFullscreen", EXIT_WINDOW_FULLSCREEN = "exitWindowFullscreen", AUTO = "auto", CURRENT_VOLUME = "currentVolume", CURRENTLY_MUTED = "currentlyMuted", SWITCH_TO_VIDEO = "switchToVideo", SWITCHING_TO_VIDEO = "switchingToVideo", SWITCHED_TO_VIDEO = "switchedToVideo", SWITCH_TO_AUDIO = "switchToAudio", SWITCHING_TO_AUDIO = "switchingToAudio", SWITCHED_TO_AUDIO = "switchedToAudio", FAIL = "fail", ERROR_PANEL_TITLE = "errorPanelTitle", ERROR_PANEL_RETRY_BTN = "errorPanelRetryBtn", LIVE = "live", RETURN_TO_LIVE = "returnToLive" } /** * @public */ export declare type ControlsModuleOption = { danmakuControlsPos?: DanmakuControlsPos; danmakuControlsPosFullscreen?: DanmakuControlsPos; } & Record<string, unknown>; /** * @public */ export declare const ControlsPluginLabel = "ControlsPlugin"; /** * @public * 播放控件插件定义 */ export declare abstract class ControlsPluginModule extends PluginModule { static label: string; /** * @override */ getLabel(): string; beforeInstall(_player: IKwaiPlayer, _options?: ControlsModuleOption): void; afterInstall(_player: IKwaiPlayer, _options?: ControlsModuleOption): void; abstract readonly container: HTMLDivElement | undefined; } export declare enum ControlsSlotPos { PLAY_BAR_LEFT = "playBarLeft", PLAY_BAR_RIGHT = "playBarRight", CONTEXT_MENU = "contextMenu" } export declare type ControlsSoltSvgBtn = { role: string; slotPos: ControlsSlotPos | string; svgRaw?: string; callback?: CallbackProxy; getTips?: () => string; getChecked?: () => boolean; getText?: () => string; onClick: () => void; }; /** * @public */ export declare enum DanmakuControlsPos { BOTTOM = "bottom", PLAY_BAR = "playBar", NONE = "none" } /** * @public */ export declare enum DanmakuPluginDomStyle { DARK = "dark", LIGHT = "light" } /** * @public */ export declare const DanmakuPluginLabel = "DanmakuPlugin"; /** * @public */ export declare abstract class DanmakuPluginModule extends PluginModule { static label: string; /** * @override */ getLabel(): string; /** * 是否渲染 */ abstract rendering: boolean; /** * 信息Dom */ abstract getInfoDom(style?: DanmakuPluginDomStyle | string): HTMLElement | undefined; /** * 控制面板 */ abstract getControlPanelDom(style?: DanmakuPluginDomStyle | string): HTMLElement | undefined; } /** * @public */ declare type DecConfig = { videoDropFramePolicy: VideoDropFramePolicy; videoFrameBufferSize: number; videoDecBlockPolicy: VideoDecBlockPolicy; maxVideoDecThreads: number; mainThreadDecoding: boolean; } & RendererConfig & LogConfig; /** * @public */ declare type DecLibLoaderConfig = { decLibLoadingMaxRetry: number; decLibConnectionTimeout: number; decLibLoadingRetryDelay: number; } & BaseLoaderConfig; /** * @public */ declare enum Decoder { buildin = "buildin", wasm = "wasm", none = "none", unsupported = "unsupported" } /** * @public */ declare type DecrypterConfig = { enableSoftwareAES: boolean; }; /** * @public */ declare type DiscontinuityEventData = { streamTimestamp: number; }; /** * @public */ declare type DownloadInfo = { domain: string; stream_host: string; download_url: string; response_url?: string; download_start_time: number; download_spend_time: number; download_status: DownloadStatus; http_status_code: number; retry_index: number; error_code: number; error_message: string; loader_id: string; download_size: number; resource_type: string; slice_play_start_time?: number; slice_play_duration?: number; slice_index?: number | 'initSegment'; slice_level_index?: number; quality_type?: string; range_start?: number; range_end?: number; codec?: string; transcoding_template?: string; http_response_time: number; response_header?: string[]; redirect?: number; time_redirect?: number; time_dns?: number; time_tcp?: number; time_request?: number; time_first_response?: number; time_response?: number; duration?: number; monkey_patched?: number; use_reset_native_fetch?: number; }; /** * REPORT事件 type === DOWNLOAD 数据 * @public */ declare type DownloadReportData = { session_id: string; kernel_version: string; load_start_time: number; use_backup: number; first_screen: number; } & DownloadInfo; /** * @public */ declare enum DownloadStatus { FAIL = "FAIL", ABORT = "ABORT", SUCCESS = "SUCCESS", CONNECTED = "CONNECTED" } /** * @public */ declare enum ErrorDetails { LOAD_ERROR = 10, MANIFEST_LOAD_ERROR = 11,// HLS manifest加载错误 LEVEL_LOAD_ERROR = 12, AUDIO_TRACK_LOAD_ERROR = 13, KEY_LOAD_ERROR = 14, KEY_SYSTEM_LICENSE_REQUEST_FAILED = 15, DEC_LIB_LOAD_ERROR = 16, RTC_SDP_LOAD_ERROR = 17, SUBTITLE_TRACK_LOAD_ERROR = 18, CANNOT_SEEK = 100, VIDEO_ERROR = 101, UNSUPPORTED = 102, CONFIG_ERROR = 103, OTHER = 104, UNKNOWN = 105, CANNOT_SEEK_BY_FRAME_INDEX = 106, SRC_EMPTY = 107, VIDEO_NO_SIZE = 108, NO_TRACKS_AVAILABLE = 109, VIDEO_ERROR_1 = 111, VIDEO_ERROR_2 = 112, VIDEO_ERROR_3 = 113, VIDEO_ERROR_4 = 114, MEDIASOURCE_ERROR = 200,// mediaSourceError 初始化MSE错误,MediaSource未定义时触发 ADDSOURCEBUFFER_ERROR = 201,// addSourceBufferError MSE增加SourceBuffer失败 SOURCEBUFFER_ERROR = 202,// sourceBufferError MSE的SourceBuffer触发错误 ENDOFSTREAM_ERROR = 203,// endOfStreamError MSE结束流错误 APPENDBUFFER_ERROR = 204,// appendBufferError MSE填充buffer错误 CHANGETYPE_ERROR = 205,// changeTypeError SourceBuffer changeType 错误 MSE_CAPABILITY_ERROR = 206, MSE_SOURCE_BUFFER_CLOSE_ERROR = 207,// mse 异常关闭 PARSING_ERROR = 301,// 解封装错误 REMUX_ERROR = 302,// 重新封装错误 REMUX_ALLOC_ERROR = 303,// 重新封装alloc mdat存储错误 REMUX_WORKER_ERROR = 304,// remux worker报错 DEMUX_NOT_FOUND = 305,// 未找到解封装器 MANIFEST_PARSING_ERROR = 400, LEVEL_NO_UPDATE_ERROR = 402, KEY_SYSTEM_NO_ACCESS = 500, KEY_SYSTEM_NO_SESSION = 501, KEY_SYSTEM_URL_ERROR = 502, KEY_SYSTEM_NO_KEYS = 505, FRAG_DECRYPT_ERROR = 506, KEY_SYSTEM_NO_INIT_DATA = 507, KEY_SYSTEM_UNSUPPORTED = 508, DECODER_LOAD_ERROR = 600, DECODER_INIT_ERROR = 601, DECODER_DRAW_ERROR = 602, DECODER_WEBGL_ERROR = 603, DECODER_UNSUPPORTED = 604, DECODER_COPY_YUV_ERROR = 605, DECODER_DEC_ERROR = 606, DECODER_2D_ERROR = 607, SCREENSHOT_INIT_ERROR = 700, SCREENSHOT_EMPTY_DATA_ERROR = 701, SCREENSHOT_CREATE_IMG_ERROR = 702, LIVE_DISCONNECTED_ERROR = 1009,// 直播连接中断 WEBRTC_DISCONNECTED_ERROR = 1010,// webrtc DISCONNECTED WEBRTC_FAILED_ERROR = 1011,// webrtc FAILED WEBRTC_CLOSED_ERROR = 1012,// webrtc CLOSED WEBRTC_ICE_CANDIDATE_ERROR = 1013,// ice协商相关错误 WEBRTC_ICE_CONNECTION_ERROR = 1014,// pc连接错误 WEBRTC_OFFER_ERROR = 1015,// 设置或Offer相关错误 WEBRTC_ANSWER_ERROR = 1016,// 设置或Answer相关错误 WEBRTC_TRANSMISSION_DATA_NULL = 1017,// 传输数据为空 WEBRTC_CONNECT_TIMEOUT = 1018,// webrtc 连接超时 WEBRTC_CONNECT_FAILED = 1019 } /** * @public */ declare type ErrorEventData = { type: ErrorTypes; details: ErrorDetails; code: number; fatal: boolean; reason: string; statusCode?: number; url?: string; } & BasicEventData; /** * @public */ export declare type ErrorMsg = { code: number; message: string; }; /** * @public */ declare enum ErrorTypes { NETWORK_ERROR = "networkError", MEDIA_ERROR = "mediaError", KEY_SYSTEM_ERROR = "keySystemError", MUX_ERROR = "muxError", OTHER_ERROR = "otherError", MSE_ERROR = "mseError", DECODER_ERROR = "decoderError", RENDERER_ERROR = "rendererError" } /** @public */ declare type ExposedEvents = Pick<typeof KEvents, 'REPORT' | 'ERROR' | 'LEVEL_SWITCHING' | 'LEVEL_SWITCHED' | 'LEVEL_SWITCH_PLAYING' | 'LEVEL_SWITCH_FAILED' | 'AUDIO_TRACK_SWITCHING' | 'AUDIO_TRACK_SWITCHED' | 'AUDIO_TRACK_UPDATED' | 'SUBTITLE_TRACK_SWITCHED' | 'MANIFEST_PARSED' | 'LEVEL_UPDATED' | 'LOAD_END' | 'VIDEO_RENDERER_CHANGE' | 'SCREENSHOT'>; /** * @public */ declare type FlvAbrAdaptationSet = { gopDuration?: number; representation: FlvAbrRepresentation[]; } & Record<string, unknown>; /** * @public */ declare type FlvAbrManifest = { version: string; hideAuto?: boolean; adaptationSet: FlvAbrAdaptationSet; } & Record<string, unknown>; /** * @public */ declare type FlvAbrRepresentation = { id?: number; url: string; name: string; bitrate: number; qualityType: string; codec?: string; averageBitrate?: number; hidden?: boolean; enableAdaptive?: boolean; defaultSelect?: boolean; mediaType?: string; level?: number; } & Record<string, unknown>; /** * @public */ declare type FlvMultipartManifest = { type: string; duration: number; withCredentials: boolean; hasAudio?: boolean; hasVideo?: boolean; segments: FlvMultipartSegment[]; } & Record<string, unknown>; /** * @public */ declare type FlvMultipartSegment = { url: string; periodId: number | string; time?: number; duration?: number | string; filesize?: number; startUtcTime?: number | string; } & Record<string, unknown>; export declare type FullScreenDirection = 'portrait' | 'right' | 'left'; /** * @public */ export declare type FullscreenEventData = { type: FullscreenType; isFull: boolean; }; /** * @public */ export declare enum FullscreenType { SYSTEM = "system", WINDOW = "window" } /** * @public * @deprecated 对应事件已弃用 */ declare type H265DetectedEventData = { canvas?: HTMLCanvasElement; message: string; enabled: boolean; decoder: Decoder; }; /** * REPORT事件 type === HEARTBEAT 数据 * @public */ declare type HeartbeatReportData = { /** * 数据下载量:单位:B */ totalReceive?: number; /** * 当前下载速度,单位:B/s */ speed?: number; /** * 视频码率, 单位:Kb/s */ videoDataRate?: number; /** * 音频码率,单位:Kb/s */ audioDataRate?: number; /** * video缓冲区长度,单位:毫秒 */ buffered?: number; /** * 视频轨缓冲区长度,单位:毫秒 */ videoBuffered?: number; /** * 音频轨缓冲区长度,单位:毫秒 */ audioBuffered?: number; /** * 解码fps */ decodedFPS?: number; /** * 丢帧fps */ droppedFPS?: number; /** * 解码帧 */ decodedFrames?: number; /** * 丢帧 */ droppedFrames?: number; /** * RTC直播 */ audioAvgJitterBufferDelay?: number; /** * RTC直播 */ videoAvgJitterBufferDelay?: number; /** * RTC直播 */ audioPacketsLost?: number; /** * RTC直播 */ videoPacketsLost?: number; /** * flv直播渲染延迟 */ displayDelay?: number; /** * flv直播音频渲染延迟 */ audioRenderDelay?: number; /** * flv直播,数据延迟 */ recDelay?: number; /** * 填充视频空帧长度,单位:毫秒 */ fillVideo?: number; /** * 填充音频空帧长度,单位:毫秒 */ fillAudio?: number; /** * 收到的关键帧数量 */ keyFrame?: number; /** * 懒加载下限 */ lazyloadMin?: number; /** * 懒加载上限 */ lazyloadMax?: number; /** * 是否处于直播时移状态 */ liveShift?: boolean; /** * 当前流是否是直播 */ isLive?: boolean; /** * wasm缓存长度 */ wasmFrameBufLen?: number; /** * 当前播放时间,毫秒 */ playPos?: number; }; /** * @public */ declare type HlsAdaptiveConfig = { beacon: boolean; predictStep: number; targetBuffer: number; duration: number; smoothRatioToTarget: number; switchpanelty: number; slidingWindowSize: number; kalmanR: number; kalmanQ: number; initBitrate: number; startBitrateLimit: boolean; speedPredictRatio: number; speedPredictNum: number; algorithm: number; speedPredictRatioOnStart: number; lowProfileThreshold: number; lowProfileBitrate: number; lowProfileStartThreshold: number; }; /** * @public */ declare type HLSManifest = { version: string; type: string; adaptationSet: HLSManifestAdaptationSet; } & Record<string, unknown>; /** * @public */ declare type HLSManifestAdaptationSet = { representation: HLSManifestRepresentation[]; } & Record<string, unknown>; /** * @public */ declare type HLSManifestRepresentation = { url: string; backupUrl: string[]; baseUrl: string; m3u8: string; bandwidth: number; averageBandwidth: number; codecs: string; width: number; height: number; frameRate: number; m3u8Slice: string; duration: number; qualityType?: string; qualityLabel?: string; defaultSelect?: boolean; } & Record<string, unknown>; /** * @public */ export declare const HotkeyPluginLabel = "HotkeyPlugin"; /** * @public */ export declare abstract class HotkeyPluginModule extends PluginModule { static label: string; /** * @override */ getLabel(): string; readonly abstract disable: boolean; } /** * @public */ declare enum HttpRangeType { STANDARD = "standard", QUERY_START_END = "queryStartEnd" } /** * @public */ export declare const I18nPluginLabel = "I18nPlugin"; /** * @public * 多语言插件定义 */ export declare abstract class I18nPluginModule extends PluginModule { static label: string; /** * @override */ getLabel(): string; beforeInstall(_player: IKwaiPlayer, _options?: I18nPluginModuleOption): void; afterInstall(_player: IKwaiPlayer, _options?: I18nPluginModuleOption): void; abstract text(pluginLabel: string, key: string): string; abstract addDict(map: LangMap, lang?: string): void; } /** * @public */ export declare type I18nPluginModuleOption = { lang?: string; langDict?: LangDict; }; export declare interface IBaseContextEvent<T extends string = any, D = null> { type: T; data: D; } /** * @public */ declare interface IDestroyable { destroy(): void; } /** * @public */ declare interface IKEventEmitter { on<T extends keyof KernelEventMap>(event: T, listener: KernelEventMap[T]): void; once<T extends keyof KernelEventMap>(event: T, listener: KernelEventMap[T]): void; removeAllListeners<T extends keyof KernelEventMap>(event?: T): void; off<T extends keyof KernelEventMap>(event: T, listener?: KernelEventMap[T]): void; emit<T extends keyof KernelEventMap>(event: T, eventObject?: Parameters<KernelEventMap[T]>[0]): boolean; listenerCount<T extends keyof KernelEventMap>(event: T): number; } /** * @public */ export declare interface IKwaiPlayer extends IPlayerEventEmitter { readonly packVersion: string; readonly version: string; readonly kernelType: KernelType; readonly error: ErrorMsg | undefined; /** * 获取当前是否时移回放 */ readonly isLiveShift: boolean; /** * 网络状态 */ readonly networkState: number; /** * 获取预加载配置 */ readonly buffered: TimeRanges | undefined; /** * 获取video元素readyState */ readonly readyState: number; /** * 获取video元素seeking状态 */ readonly seeking: boolean; /** * 获取video时长 */ readonly duration: number; /** * 获取暂停状态 */ readonly paused: boolean; /** * 获取是否播放 */ readonly played?: TimeRanges; /** * 获取是否可以seek */ readonly seekable?: TimeRanges; /** * 获取是否播放完成 */ readonly ended: boolean; /** * 当前清晰度时间信息 */ readonly currentLevelTimeInfo: LevelTimeInfo | undefined; readonly video: HTMLVideoElement; readonly canvas: HTMLCanvasElement | undefined; readonly yodaDom: HTMLDivElement | undefined; readonly kernel: KwaiPlayerKernel | undefined; /** * 获取主容器 */ readonly mainContainer: HTMLElement | null | undefined; readonly videoLayer: HTMLDivElement; readonly videoInteractiveLayer: HTMLDivElement; /** * 获取当前QOS信息 */ readonly audienceStat: unknown; readonly objectFit?: string; /** * 设置内核配置 */ config: Partial<KernelConfig> | undefined; videoId: string | undefined; previewUrl: string | undefined; maskUrl: string | undefined; disableMask: boolean | undefined; /** * 播放地址 */ src: MediaDescription | unknown; /** * 直播时移类型 */ liveShiftType: LiveShiftType; /** * 跨域 */ crossOrigin: string | null; /** * 预加载 'none' | 'auto' */ preload: string; /** * video播放时间 */ currentTime: number; /** * 默认倍速 */ defaultPlaybackRate: number; /** * 当前倍速 */ playbackRate: number; /** * 是否自动播放 */ autoplay: boolean; /** * 是否循环播放 */ loop: boolean; /** * 是否显示控制条 */ controls: boolean | string; /** * 音量 */ volume: number; /** * 静音 */ muted: boolean; /** * 默认静音状态 */ defaultMuted: boolean; /** * 视频宽 */ videoWidth: number; /** * 视频高 */ videoHeight: number; /** * 封面图 */ poster: string; /** * 禁用画中画状态 */ disablePictureInPicture: boolean; disableDownload: boolean | undefined; /** * 内联(inline)播放 */ playsinline: boolean; /** * 自适应码率开关状态 */ disableAdaptive: boolean | undefined; /** * 当前视频轨id */ currentLevel: number; /** * 获取即将切换的视频轨id */ nextLevel: number; /** * 获取当前播放帧数 */ currentVideoFrame: number; /** * 获取当前视频总帧数 */ totalVideoFrames: number; /** * 当前音频轨id */ audioTrack: number; productName: string | undefined; /** * 获取当前是否开启连接预热 */ prefetch: boolean | undefined; /** * 获取是否显示进度条 * @remarks 依赖控制条插件 */ showProgress: boolean | undefined; /** * 获取是否显示时间 * @remarks 依赖控制条插件 */ showTime: boolean | undefined; /** * 获取是否启用热键 * @remarks 依赖热键插件 */ disableHotkey: boolean | undefined; /** * 弹幕是否可用 */ disableDanmaku: boolean | undefined; danmakuRendering: boolean | undefined; /** * 设置是否显示信息面板 * @remarks 依赖信息面板插件 */ showInfoPanel: boolean | undefined; showNext: boolean | undefined; showPrev: boolean | undefined; bizData: BizData | undefined; liveTime: LiveTime | undefined; /** * 实例id */ instanceId: number; /** * 本地日志实例 */ logger: ILogger_2; /** * 本地日志输出 */ outputLogger?: ILogger_2; setPreprocessURL(val: PreprocessURL | undefined): void; setPreprocessSrcFunc(val: PreprocessSrcFunc): void; /** * 加载视频 */ load(): void; /** * 播放视频 */ play(): Promise<void>; /** * 暂停视频 */ pause(): void; /** * 开启画中画 */ requestPictureInPicture(): Promise<PictureInPictureWindow>; isPictureInPictureAvailable(): boolean; /** * 销毁播放器 */ destroy(): void; /** * 重新加载视频 */ refresh(): void; /** * 支持时移时回到直播状态 */ jumpToLive(): void; /** * 根据插件名获取插件实例 * @param label 插件名 * @returns plugin */ getPluginInstance<pluginLabel extends keyof PluginMap>(label: string | pluginLabel): PluginMap[pluginLabel] | undefined; /** * 获取所有的插件实例 * @returns 所有的插件实例 */ getAllPlugins(): PluginModule[]; /** * 创建一个子容器 * @returns HTMLDivELement */ createSubContainer(layer?: KwaiPlayerLayer): HTMLDivElement; /** * 是否全屏 * @returns boolean */ isFullscreen(type?: FullscreenType): boolean; /** * 开启全屏 * @param type 'system' 系统全屏 'window' 网页全屏 * @returns */ requestFullscreen: (type?: FullscreenType) => void; /** * 退出全屏 * @param type 'system' 系统全屏 'window' 网页全屏 * @returns */ exitFullscreen: (type?: FullscreenType) => void; isFullscreenAvailable(type?: FullscreenType): boolean; removeSubContainer(container: HTMLDivElement): void; /** * 截图 */ screenshot(): Promise<ImageData | void>; } export declare interface ILiveSrc { liveStreamId: string; liveAdaptiveManifest?: Record<string, unknown>[]; multiResolutionPlayUrls?: Record<string, unknown>[]; playUrls?: Record<string, unknown>[]; [key: string]: unknown; } /** * @public */ declare interface ILogger { e: LogOutputFunc; w: LogOutputFunc; i: LogOutputFunc; d: LogOutputFunc; v: LogOutputFunc; } /** * @public */ declare interface ILogger_2 { e: LogOutputFunc_2; w: LogOutputFunc_2; i: LogOutputFunc_2; d: LogOutputFunc_2; v: LogOutputFunc_2; setOutput?(output?: ILogger_2): ILogger_2 | undefined; } /** * 输入媒体描述 * 输入MediaDescription或者MixContainerMediaDescription数组 * 输入MixContainerMediaDescription数组时,播放SDK会以数组顺序作为优先级选择浏览器可支持的视频类型 * @example * 输入flv流和hls流,在大部分情况都会播放flv格式的流,在iOS上会播放hls的流 * ``` * [ * {src: "http://xxxx/xxx.flv"}, * {src: "http://xxxx/xxx.m3u8"} * ] * ``` * @see MediaDescription * @see MixContainerMediaDescription * @public */ declare type InputMediaDescription = MediaDescription | MixContainerMediaDescription[]; export declare type InputSrc = { isLive: true; src: ILiveSrc; } | { isLive: false; src: IVideoSrc[] | Manifest; } | ''; export declare type InteractionData = { type: 'progresschange'; data: { time: number; }; } | { type: Exclude<InteractionType, InteractionTypeWithData>; }; export declare type InteractionType = 'clicknext' | 'clickprev' | 'clicklogin' | 'clickregister' | 'clicksenddanmaku' | 'clickvip' | InteractionTypeWithData; declare type InteractionTypeWithData = 'progresschange'; /** * @public */ declare interface IPlayerEventEmitter { on<eventName extends keyof PlayerEventMap>(event: eventName, listener: PlayerEventMap[eventName]): void; once<eventName extends keyof PlayerEventMap>(event: eventName, listener: PlayerEventMap[eventName]): void; removeAllListeners<eventName extends keyof PlayerEventMap>(event?: eventName): void; off<eventName extends keyof PlayerEventMap>(event: eventName, listener?: PlayerEventMap[eventName]): void; emit<eventName extends keyof PlayerEventMap>(event: eventName, eventObject?: Parameters<PlayerEventMap[eventName]>[0]): boolean; listenerCount<eventName extends keyof PlayerEventMap>(event: eventName): number; } export declare interface IVideoSrc { url: string; } export declare interface IYodaError { type: string; originalError: { message: string; code?: number; }; } export declare type IYodaEventMap = { play: IBaseContextEvent<'play'>; playing: IBaseContextEvent<'playing'>; pause: IBaseContextEvent<'pause'>; loadedmetadata: IBaseContextEvent<'loadedmetadata', { duration: number; }>; timeupdate: IBaseContextEvent<'timeupdate', { to: number; }>; ended: IBaseContextEvent<'ended'>; waiting: IBaseContextEvent<'waiting'>; seeked: IBaseContextEvent<'seek', { to: number; }>; seeking: IBaseContextEvent<'seeking'>; fullscreenchange: IBaseContextEvent<'fullscreenchange', { isFull: boolean; }>; abloopended: IBaseContextEvent<'abloopended'>; error: IBaseContextEvent<'error', IYodaError>; speedChange: IBaseContextEvent<'speedChange', { speed: number; }>; resize: IBaseContextEvent<'resize', { width: number; height: number; }>; firstFrame: IBaseContextEvent<'firstFrame'>; }; export declare const IYodaKernel: { prototype: IYodaKernel; new (container: HTMLElement, logger: ILogger_2, conf?: Partial<UserConfig>): IYodaKernel; }; export declare interface IYodaKernel { readonly duration: number; readonly videoWidth: number; readonly videoHeight: number; readonly seeking: boolean; readonly paused: boolean; readonly readyState: number; readonly ended: boolean; readonly error?: IYodaError; readonly actionOnReady?: ActionOnReady; autoplay: boolean; loop: boolean; defaultMuted: boolean; muted: boolean; defaultPlaybackRate: number; playbackRate: number; src: InputSrc | undefined; currentTime: number; objectFit: 'contain' | 'fill' | 'cover'; updateUserConfig(conf?: Partial<UserConfig>): void; play(): Promise<void>; pause(): Promise<void>; destroy(): Promise<void>; isFullscreen(): boolean; fullScreen(direction: FullScreenDirection): Promise<void>; exitFullScreen(): Promise<void>; screenshot(): Promise<ImageData | void>; on<K extends keyof IYodaEventMap>(event: K, listener: (e: IYodaEventMap[K]) => void): void; once<K extends keyof IYodaEventMap>(event: K, listener: (e: IYodaEventMap[K]) => void): void; off<K extends keyof IYodaEventMap>(event: K, listener: (e: IYodaEventMap[K]) => void): void; emit<K extends keyof IYodaEventMap>(event: K, eventObject?: IYodaEventMap[K]): boolean; prependListener<K extends keyof IYodaEventMap>(event: K, listener: (e: IYodaEventMap[K]) => void): void; prependOnceListener<K extends keyof IYodaEventMap>(event: K, listener: (e: IYodaEventMap[K]) => void): void; removeAllListeners<K extends keyof IYodaEventMap>(event?: K): void; } /** * @public */ export declare type KernelConfig = {} & BaseConfig & TransConfig & RTCConfig; /** * @public */ declare interface KernelEventMap { [KEvents.MANIFEST_PARSED]: (data: ManifestEventData) => void; [KEvents.LEVEL_SWITCHING]: (data: LevelEventData) => void; [KEvents.LEVEL_SWITCHED]: (data: LevelEventData) => void; [KEvents.LEVEL_SWITCH_PLAYING]: (data: LevelEventData) => void; [KEvents.LEVEL_SWITCH_FAILED]: () => void; [KEvents.AUDIO_TRACK_UPDATED]: (data: LevelTimeInfo | undefined) => void; [KEvents.AUDIO_TRACK_SWITCHING]: (data: LevelEventData) => void; [KEvents.AUDIO_TRACK_SWITCHED]: (data: LevelEventData) => void; [KEvents.AUDIO_TRACK_SWITCH_FAILED]: () => void; [KEvents.SUBTITLE_TRACK_SWITCHED]: (data: BaseLevelEventData) => void; [KEvents.LEVEL_UPDATED]: (data: LevelTimeInfo | undefined) => void; [KEvents.LOAD_END]: (data: BasicEventData) => void; [KEvents.VIDEO_RENDERER_CHANGE]: (data: VideoRendererChangeEventData) => void; [KEvents.H265_DETECTED]: (data: H265DetectedEventData) => void; [KEvents.ERROR]: (data: ErrorEventData) => void; [KEvents.REPORT]: (data: ReportData) => void; [KEvents.SCREENSHOT]: (data: ScreenshotEventData) => void; } export declare type KernelType = 'kwai-player-kernel' | 'yoda' | 'unknown'; /** * @public */ declare enum KEvents { /* Excluded from this release type: METADATA */ /* Excluded from this release type: MEDIA_INFO */ /* Excluded from this release type: PARSING_INIT_SEGMENT */ /* Excluded from this release type: PARSING_DATA */ /* Excluded from this release type: PARSED_DATA */ /* Excluded from this release type: SCRIPT_PARSED */ /* Excluded from this release type: KEY_FRAME_INDEXS */ /* Excluded from this release type: VIDEO_FRAME_INFO */ /* Excluded from this release type: DISCONTINUITY */ /** * 视频播放相关信息会从该事件抛出,需要根据抛出数据的type类型处理数据 */ REPORT = "report", /** * 下载完成 */ LOAD_END = "loadEnd", /** * 错误 */ ERROR = "error", /** * manifest加载完成 */ MANIFEST_LOADED = "manifestLoaded", /** * manifest解析完成,需要在此事件中处理多码率信息 */ MANIFEST_PARSED = "manifestParsed", /** * level开始切换,开始切换流 */ LEVEL_SWITCHING = "levelSwitching", /** * level已切换,切换的流开始下载 */ LEVEL_SWITCHED = "levelSwitched", /** * level已切换,切换的流开始播放 * 用于平滑切换清晰度,平滑切换清晰度的切换过程会有延迟 */ LEVEL_SWITCH_PLAYING = "levelSwitchPlaying", /** * level切换失败 */ LEVEL_SWITCH_FAILED = "levelSwitchFailed", /* Excluded from this release type: LEVEL_LOADED */ /** * level信息已更新(mediaplylist) */ LEVEL_UPDATED = "levelUpdated", /** * 音频轨开始切换,用于音视频数据分离的视频 */ AUDIO_TRACK_SWITCHING = "audioTrackSwitching", /** * 音频轨切换完成,用于音视频数据分离的视频 */ AUDIO_TRACK_SWITCHED = "audioTrackSwitched", /** * 音频轨信息已更新(mediaplylist),用于音视频数据分离的视频 */ AUDIO_TRACK_UPDATED = "audioTrackUpdated", /** * 音频轨切换失败 */ AUDIO_TRACK_SWITCH_FAILED = "audioTrackSwitchFailed", /* Excluded from this release type: HLS_MANIFEST_PARSED */ /* Excluded from this release type: HLS_KEY_LOADED */ /* Excluded from this release type: AUDIO_TRACK_LOADED */ /* Excluded from this release type: SUBTITLE_TRACK_LOADED */ /* Excluded from this release type: SUBTITLE_LOADED */ /** * 字幕轨切换完成 */ SUBTITLE_TRACK_SWITCHED = "subtitleTrackSwitched", /** * 字幕轨信息已更新(mediaplylist) */ SUBTITLE_TRACK_UPDATED = "subtitleTrackUpdated", /* Excluded from this release type: BUFFER_CLEANING */ /* Excluded from this release type: VIDEO_SEEK */ /* Excluded from this release type: ABR_NEXT */ /* Excluded from this release type: PRIV_NAL */ /* Excluded from this release type: SEI */ /** * AAC 私有信息 */ AAC_PRIV = "aacPriv", /* Excluded from this release type: RAW_DATA */ /* Excluded from this release type: MP4_NOT_FASTSTART */ /* Excluded from this release type: VIDEO_CODEC_DETECTED */ /** * 检测到h265,需要解码器 * @deprecated VIDEO_RENDERER_CHANGE替代 */ H265_DETECTED = "h265Detected", /** * 渲染方式变更 */ VIDEO_RENDERER_CHANGE = "videoRendererChange", /* Excluded from this release type: DEC_LIB_LOADED */ /* Excluded from this release type: DEC_INIT_COMPLETE */ /* Excluded from this release type: DEC_VIDEO_READY */ /* Excluded from this release type: STEP */ /* Excluded from this release type: RENDERER_INIT_COMPLETE */ /* Excluded from this release type: RENDERER_BUF_EXPIRED */ /* Excluded from this release type: RENDERER_SEEK */ /* Excluded from this release type: RENDERER_BUF_UPDATE */ /* Excluded from this release type: RENDERER_DRAW */ /* Excluded from this release type: RENDERER_WAITING */ /* Excluded from this release type: RENDERER_WAITING_END */ /* Excluded from this release type: DECODER_FRAME */ /* Excluded from this release type: DECODER_IMG */ /* Excluded from this release type: DECODER_SEEK */ /* Excluded from this release type: DECODER_SEEK_ABORT */ /* Excluded from this release type: DECODER_WAITING */ /* Excluded from this release type: DECODER_DATA_END */ /* Excluded from this release type: DECODER_BUF_LOW */ /* Excluded from this release type: DECODER_DROP_FRAME */ /* Excluded from this release type: DECODER_MEDIA_INFO */ /* Excluded from this release type: MEDIA_CONNECTED */ /* Excluded from this release type: LOADER_CHUNK_ARRIVAL */ /* Excluded from this release type: DEMUXER_DETECTED */ /* Excluded from this release type: MEDIA_DEMUX */ /* Excluded from this release type: KEY_FRAME */ /* Excluded from this release type: USE_BACKUP */ /* Excluded from this release type: NEW_SOURCE */ /* Excluded from this release type: DOWNLOAD */ /* Excluded from this release type: STOP_LOAD */ /* Excluded from this release type: LOAD */ /* Excluded from this release type: WAITING */ /* Excluded from this release type: LOADEDMETADATA */ /* Excluded from this release type: LOADEDDATA */ /* Excluded from this release type: CANPLAY */ /* Excluded from this release type: SEEKING */ /* Excluded from this release type: SEEK_WITH_LOAD */ /* Excluded from this release type: SEEKED */ /* Excluded from this release type: PLAYING */ /* Excluded from this release type: PAUSE */ /* Excluded from this release type: PLAY */ /* Excluded from this release type: ENDED */ /* Excluded from this release type: TIMEUPDATE */ /* Excluded from this release type: PROGRESS */ /* Excluded from this release type: RATE_CHANGE */ /* Excluded from this release type: DURATION_CHANGE */ /* Excluded from this release type: HEARTBEAT */ /* Excluded from this release type: MSE_UPDATE */ /* Excluded from this release type: MSE_BUFFER_FULL */ /* Excluded from this release type: MSE_SOURCE_CLOSE */ /* Excluded from this release type: RETRY */ /* Excluded from this release type: WORKER_LOG */ /* Excluded from this release type: VISIBILITY_CHANGE */ /** * 截图 */ SCREENSHOT = "screenshot" } /** * REPORT事件 type === KEY_FRAME 数据 * @public */ declare type KeyFrameReportData = { cts: number; pts: number; }; /** * @public */ declare type KeyLoaderConfig = { emeEnabled: boolean; widevineLicenseUrl: string; playreadyLicenseUrl: string; fairplayLicenseUrl: string; keyLoadingMaxRetry: number; keyConnectionTimeout: number; keyTransmissionTimeout: number; keyLoadingRetryDelay: number; }; /** * @public */ declare type KLevel = { width?: number; height?: number; qualityLabel?: string; qualityType?: string; bitrate: number; maxBitrate?: number; }; /** * @public */ declare type KwaiAdaptationSet = { id: number; duration: number; drmSchemaId?: string; drmToken?: string; mimeType?: string; language?: string; representation: KwaiRepresentation[]; } & Record<string, unknown>; /** * @public */ declare type KwaiManifest = { version: string; businessType: number; mediaType: number; videoId?: string; hideAuto?: boolean; manualDefaultSelect?: boolean; stereoType?: number; videoBaseFeature?: string; videoAestheticFeature?: string; videoFeature?: { blurProbability: number; blockyProbability: number; avgEntropy: number; mosScore: number; }; programStartTime?: number; adaptationSet: KwaiAdaptationSet[]; } & Record<string, unknown>; /** * 创建播放实例 * * @param id 播放组件所在Dom容器ID * @param data 播放组件传入的参数 * * @extends EventEmitter * * @example * // 自动播放 * new KwaiPlayer('container-id',{ * autoplay: true, * }) * @example * // 指定内核参数,如优先使用原生播放 * new KwaiPlayer('container-id',{ * config:{ * nativeFirst: true * } * }) * @public */ export declare class KwaiPlayer implements IKwaiPlayer { static packVersion: string; /* Excluded from this release type: _pluginBase */ /* Excluded from this release type: _eventHandlers */ /* Excluded from this release type: _evt */ /* Excluded from this release type: _mainDom */ /* Excluded from this release type: _video */ /* Excluded from this release type: _kernel */ /* Excluded from this release type: _error */ /* Excluded from this release type: _config */ /* Excluded from this release type: _src */ /* Excluded from this release type: _autoplay */ /* Excluded from this release type: _preload */ /* Excluded from this release type: _poster */ /* Excluded from this release type: _controls */ /* Excluded from this release type: _videoWidth */ /* Excluded from this release type: _videoHeight */ /* Excluded from this release type: _kernelLoaded */ /* Excluded from this release type: _livePaused */ /* Excluded from this release type: _canvas */ /* Excluded from this release type: _mediaInfo */ /* Excluded from this release type: _logger */ /* Excluded from this release type: _isLiveShift */ /* Excluded from this release type: _full */ /* Excluded from this release type: _subContainerNumber */ /* Excluded from this release type: _data */ /* Excluded from this release type: _id */ /* Excluded from this release type: _videoLayer */ /* Excluded from this release type: _videoInteractiveLayer */ /* Excluded from this release type: _posterLayer */ /* Excluded from this release type: _preprocessSrcFunc */ /* Excluded from this release type: _preprocessURL */ /* Excluded from this release type: _kernelStartTimeout */ /* Excluded from this release type: _instanceId */ /* Excluded from this release type: _yodaClass */ /* Excluded from this release type: _yodaDom */ /* Excluded from this release type: _yoda */ /* Excluded from this release type: _kernelType */ /* Excluded from this release type: _outputLogger */ /* Excluded from this release type: _yodaEnabled */ /* Excluded from this release type: _screenshotId */ /* Excluded from this release type: _screenshotQueue */ /* Excluded from this release type: _observer */ /* Excluded from this release type: _objectFit */ static get version(): string; constructor(id: string | HTMLElement, data?: KwaiPlayerData); /** * 获取版本号 */ get version(): string; /** * 获取包版本号 */ get packVersion(): string; /** * 实例ID */ get instanceId(): number; /** * 获取内核类型 */ get kernelType(): KernelType; /** * 本地日志实例 */ get logger(): ILogger_2; get outputLogger(): ILogger_2 | undefined; set outputLogger(val: ILogger_2 | undefined); /** * 配置 */ get config(): Partial<KernelConfig> | undefined; set config(val: Partial<KernelConfig> | undefined); /** * 获取当前错误 */ get error(): ErrorMsg | undefined; /** * videoId */ get videoId(): string | undefined; set videoId(val: string | undefined); /** * 设置预览图url * @remark 依赖预览图插件 */ get previewUrl(): string | undefined; set previewUrl(val: string | undefined); /** * 设置弹幕防挡url * @remark 依赖弹幕防挡插件 */ get maskUrl(): string | undefined; set maskUrl(val: string | undefined); /** * 禁用弹幕防挡url */ get disableMask(): boolean | undefined; set disableMask(val: boolean | undefined); /** * 获取播放地址 */ get src(): MediaDescription | unknown; set src(val: MediaDescription | unknown); /** * 获取当前是否时移回放 */ get isLiveShift(): boolean; set liveShiftType(val: LiveShiftType); /** * 直播时移类型 */ get liveShiftType(): LiveShiftType; set crossOrigin(val: string | null); /** * 跨域配置 */ get crossOrigin(): string | null; /** * 网络状态 */ get networkState(): number; /** * 预加载配置 */ get preload(): PreloadStr; set preload(val: PreloadStr); /** * 获取预加载配置 */ get buffered(): TimeRanges | undefined; /** * 获取video元素readyState */ get readyState(): number; /** * 获取video元素seeking状态 */ get seeking(): boolean; /** * 获取video播放时间 */ get currentTime(): number; set currentTime(val: number); /** * 获取video时长 */ get duration(): number; /** * 获取暂停状态 */ get paused(): boolean; /** * 获取默认倍速 */ get defaultPlaybackRate(): number; set defaultPlaybackRate(val: number); /** * 获取当前倍速 */ get playbackRate(): number; set playbackRate(val: number); /** * 获取是否播放 * yoda返回undefined */ get played(): TimeRanges | undefined; /** * 获取是否可以seek * yoda返回undefined */ get seekable(