window.pnplayer() with your options.
Each customer receives their own versioned build at
https://cdn.pnplayer.com/<client>/<version>/. Copy the exact <script> and <link> tags for your latest build from your builds page at https://cdn.pnplayer.com/builds/index.html?client=<client>. The file names below are placeholders.Steps
1
Include PN Player resources in your page head
2
Create the container elements
Add a wrapper with the id
pnplayer and an inner element for the player to mount on.3
Initialise the player
Call The returned object is the player instance you use for controls and events.
pnplayer with the id of the inner element and your options. Wait for the bundle to load first, for example inside window.onload.Full example
Options
object[]
required
One entry per video. With more than one entry the player shows a playlist menu and, in
playlist mode, an Up Next countdown at the end of each video. The entry with default: true plays first, otherwise the first entry does.string
Your API key from the dashboard. Required for playback analytics. Also used to remember each viewer’s caption style preferences in their browser.
string
Label for where the video is being watched, for example
Website or iOS app. Reported with analytics. Defaults to the page hostname.string
Your identifier for the current viewer. Reported with analytics so you can view watch data per user.
string
Set to
playlist to auto-advance through sources with an Up Next countdown ten seconds before each video ends. When omitted, viewers can still switch videos from the playlist menu but the player does not auto-advance.boolean
default:"true"
Start playback as soon as the video can play. Browsers may still require
muted: true for autoplay to succeed without user interaction.boolean
default:"false"
Start playback muted
object
Analytics
Whenkey is set and the source URL follows the https://<host>/<video-id>/playlist.m3u8 pattern, the player reports playback to PN Player analytics automatically:
- a
playevent on first play - a
progressorpauseevent every ten seconds - an
endevent when the video finishes - a live heartbeat every five seconds for the live analytics view
source, userId, a per-page session id and the language of the caption track currently showing.
Caption styling from the VTT file
Add aNOTE karaoke-config block to a WebVTT caption file to style that track. The player reads the block when the track is selected.
font-size, font-family, font-weight, font-style, text-transform, letter-spacing, active-color, active-shadow, past-color, past-shadow, future-color, future-shadow and background-color. Use background-color: none for a transparent cue background.