Concepts
Using the player SDK means interacting with the io.video.videokit.player.Player
interface.
This interface provides functions to control video playback, content, position and rendering.
It also collects important events and dispatches them to subscribers that were registered with the
addListener*
functions.
We recommend listening at least to the error event:
We provide different implementations that can be used within your app depending on your needs, but all of them share the same API surface described below.
#
Player interfaceNote: if you use the default controls, the user will be able to control the player through the user interface, so there's no need to interact directly with most of these functions.
#
Playback controlPlayback is controlled through simple play
and pause
functions.
#
Content controlAll player implementations can play a single Video
object, a list of Video
s or a Playlist
.
As soon as the content is set through set
(regardless of the play flag), it starts being buffered
and prepared for playback.
#
Position controlAt any given time, you can retrieve the content duration
, the current playback
position
and the bufferedPosition
, which is the position of the last video frame
available for playback. Buffering will proceed efficiently as the content is played.
We also offer seek*
functions to change the current position.
#
Other optionsWe also offer a few extra options that can be used to configure the player:
aspectMode
: eitherAspectMode.FILL
,AspectMode.CENTER_CROP
orAspectMode.CENTER_INSIDE
.loop
: whether the video should be re-played once it ends.mute
: whether the audio is muted or not.playbackQuality
: eitherQuality.AUTO
(recommended) or a fixed value (Quality.FIXED_144P
,Quality.FIXED_240P
,Quality.FIXED_360P
,Quality.FIXED_540P
,Quality.FIXED_720P
).useHls
: a boolean to enable or disable HLS playback, true by default (recommended).
Note that when playbackQuality
and useHls
are changed, any Playlist
that is
being played should also be modified accordingly, as you can read in the playlist documentation.
This ensures that playlist preloading matches the video renditions that will be actually used by the player.