Skip to main content

Prerequisites

The object returned by window.pnplayer() is your handle on the player. This page calls it player.

Control methods

Commands you send before the player is ready are queued and run as soon as the first video can play, so you can call player.play() straight after creating the instance.
function
Start or resume playback
function
Pause playback
function
Jump to a position in the current video. time is in seconds.
function
Enter fullscreen. Viewers leave fullscreen with the player controls or the Escape key.
function
Switch to another entry from your sources array without reloading the player. Pass the source object itself, for example player.switchVideo(options.sources[1]). Fires playlistItem.
property
The underlying media player instance for advanced use. null until the ready event fires.
function
Remove all event listeners and unmount the player from the page

Events

Attach and remove listeners with player.on(event, callback) and player.off(event, callback). Pass the same function reference to off that you passed to on.
string
function
Called with the event payload each time the event fires

Example