Video player API for JavaScript
Control the Kinescope player embedded on your page: play, seek, change speed and quality, switch subtitles and playlists, and react to what the viewer does.
Control the player from your code
A real Kinescope player. Each button calls an IFrame Player API method, the panel shows the code that ran, and the log shows the events the player sends back.
- currentTime
- 0
- paused
- true
- playbackRate
- 1
- quality
- —
- volume
- 1
- muted
- false
seekTo(90) to jump to 1:30. // Try seekTo(90) in the live player - Events appear here once the player loads.
import { load } from '@kinescope/player-iframe-api-loader';
const factory = await load();
const player = await factory.create('player', {
url: 'https://kinescope.io/56Jg27MqvvttAwHcrCzEA4',
size: { width: '100%', height: '100%' },
});
player.on(player.Events.TimeUpdate, ({ data }) => {
console.log(data.currentTime, data.percent);
});
Every method and event is in the IFrame Player API docs.
Quick start
npm install @kinescope/player-iframe-api-loader
added 1 package in 1s
import * as iframeApiLoader from '@kinescope/player-iframe-api-loader';
const factory = await iframeApiLoader.load();
const player = await factory.create('player', {
url: 'https://kinescope.io/VIDEO_ID',
size: { width: '100%', height: 400 },
});
player.on(player.Events.Ended, () => {
console.log('Lesson finished');
});
await player.seekTo(90);
await player.setPlaybackRate(1.5);
await player.play();
npm install @kinescope/player-iframe-api-loader
added 1 package in 1s size and behavior are optional.
import * as iframeApiLoader from '@kinescope/player-iframe-api-loader';
const factory = await iframeApiLoader.load();
const player = await factory.create('player', {
url: 'https://kinescope.io/VIDEO_ID',
size: { width: '100%', height: 400 },
}); on, once and off.
player.on(player.Events.Ended, () => {
console.log('Lesson finished');
});
await player.seekTo(90);
await player.setPlaybackRate(1.5);
await player.play(); Methods you’ll use most
Every method returns a Promise. All 33 methods in the API docs.
-
playPromise() · pause () Start or pause playback.
-
seekToPromise(time) Jump to a second, for example to resume a lesson.
-
getCurrentTimePromise<number>() Where the viewer is now, in seconds.
-
getDurationPromise<number>() Length of the video, in seconds.
-
setPlaybackRatePromise(value) Change speed, for example 1.5.
-
setVideoQualityPromise(q) Fix a quality, such as 720p.
-
enableTextTrackPromise(lang) Turn on subtitles in a language.
-
setFullscreenPromise(on) Enter or leave fullscreen.
-
switchToPromise(id) · next () Change the video in a playlist.
-
setOptionsPromise(options) Change player options on the fly, such as the watermark.
Events
-
LoadedCall methods safely after it.The player and video are ready.
-
Play ·Sync your own buttons.Pause The viewer starts or pauses.
-
TimeUpdateSave lesson progress.Playback position changes.
-
EndedMark a lesson as watched, open the next one.The video reaches the end.
-
QualityChangedLog what viewers actually get.The quality switches.
-
CallActionCount clicks or open a form.A viewer clicks a call to action.
-
ErrorShow your own message or report it.Playback fails.
-
player.onAlso once and off.(Events.Ended, fn) Subscribe to any event.
Documentation and code
-
Documentation
-
Code
-
Tools
FAQ
Can’t find the answer you need? Check out our Player docs.
@kinescope/player-iframe-api-loader, call load() to get the player factory, create the player with factory.create(element, { url }), then call its methods and subscribe to events with player.on(player.Events.Ended, handler). The quick start on this page has the code.Ended for the end of the video and to TimeUpdate for the current position, then save progress on your backend. getCurrentTime() and getDuration() return the values on demand.onKinescopeIframeAPIReady callback and adds TypeScript types. If the IFrame API script is already on the page, use window.Kinescope.IframePlayer directly; the types are available on their own from @kinescope/player-iframe-api-loader/types.






