Method
The NPlayer instance method is as follows.
mount(container?: HTMLElement | string): void
#
Mount player
to the DOM.If the parameter container
is not passed during initialization, then the parameter is required when calling the function.
incVolume(v = this.opts.volumeStep): void
#
Volume increments, step length is set for volumeStep
.
decVolume(v = this.opts.volumeStep): void
#
Decrease volume, step length is set to volumeStep
.
toggleVolume(): void
#
Restore or mute volume.
forward(v = this.opts.seekStep): void
#
Forward, step in value seekStep
.
rewind(v = this.opts.seekStep): void
#
Rewind, step in to SeekStep
.
play(): Promise<void> | void
#
Play video. Nothing to return to some old browsers.See HTMLMediaElement。
pause(): void
#
Pause video.
toggle(): void
#
Play or pause video.
seek(seconds: number): void
#
Video jumps to specified events.
use(plugin: Plugin): this
#
Install plugin.
updateControlItems(items: (string | ControlItem)[], index?: number): void
#
Update control entry, default index
is ``- the bottom line.For further information, see control bar.
registerSettingItem(item: SettingItem, id?: string): void
#
Sign up for settings, see plugins
registerContextMenuItem(item: ContextMenuItem, id?: string): void
#
注册右键菜单项,详情请查看 插件。
registerControlItem(item: ControlItem, id?: string): void
#
注册控制条项,详情请查看 插件。
getSettingItem(id: string): SettingItem | null
#
获取指定设置项,详情请查看 设置菜单。
getContextMenuItem(id: string): ContextMenuItem | null
#
获取指定右键菜单项,详情请查看 右键菜单。
getControlItem(id: string): ControlItem | null
#
获取指定控制条项,详情请查看 控制条。
updateOptions(opts: PlayerOptions): void
#
更新播放器参数,详情请查看 快速开始。
disableClickPause(): void
#
禁用单击播放/暂停视频。
enableClickPause(): void
#
启用单击播放/暂停视频。
dispose(): void
#
销毁播放器对象。