To start playing your video, you'll need to create your media info object and then use the loadMedia
API. Here are the required steps.
First, define your media info object:
var mediaInfo = {
...
};
To learn how to fill your media info object correctly, click the relevant media information documentation below.
Note: For OVP players, you'll only need to fill the entryId or referenceId (at least one is mandatory) and the KS (optional). If both entryid and referenceId are provided, the entryid has precendence. For Cloud TV players, you'll need to provide these parameters and more. See details below.
MediaInfo Documentation - OVP
{
entryId: string,
ks: string,
referenceId: string
}
Parameters
Name | Type | Description | Possible Values | Default Value |
---|---|---|---|---|
entryId |
string |
The entry ID of the media | ||
referenceId |
string |
A reference ID of the media (instead of the entry ID) | ||
ks |
string |
The KS (Kaltura Session) secret |
Note: *** Either entryId or referenceId must be supplied (if both will be supplied, the media will be loaded by mediaId)
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID'
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
ks: 'YOUR_KS'
};
var mediaInfo = {
referenceId: 'YOUR_REFERENCE_ID'
};
MediaInfo Documentation - Cloud TV
{
entryId: string,
ks: string,
mediaType: string,
contextType: string,
assetReferenceType: string,
protocol: string,
fileIds: string,
streamerType: string,
urlType: string,
formats: Array<string>
}
Parameters
Name | Type | Description | Possible Values | Default Value |
---|---|---|---|---|
entryId |
string |
The entry ID of the media | ||
referenceId |
string |
The reference ID of the media (instead of the entry ID) | ||
mediaType |
string |
The type of the specific media | "media" , "epg" , "recording" |
"media" |
assetReferenceType |
string |
The asset type of the specific media | "media" , "epg_internal" , "epg_external" |
"media" |
contextType |
string |
The playback context type | "PLAYBACK" , "CATCHUP" , "START_OVER" , "TRAILER" |
"PLAYBACK" |
ks |
string |
The KS (Kaltura Session) secret | ||
protocol |
string |
The protocol of the specific media | "https" , "http" |
|
fileIds |
string |
List of comma-separated media file IDs | ||
streamerType |
string |
The playback streamer type | "applehttp" , "mpegdash" , "url" , "smothstreaming" , "none" |
|
urlType |
string |
The playback url type | "PLAYMANIFEST" , "DIRECT" |
|
formats |
Array<string> |
Device types as defined in the system. |
Note: *** Either entryId or referenceId must be supplied (if both will be supplied, the media will be loaded by mediaId)
Let's look at some examples.
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID'
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
ks: 'YOUR_KS'
...
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
protocol: 'https'
...
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
mediaType: 'epg'
...
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
contextType: 'TRAILER'
...
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
fileIds: 'FILE_ID1,FILE_ID2'
...
};
var mediaInfo = {
entryId: 'YOUR_ENTRY_ID',
formats: ['Device_Format_1', 'Device_Format_2', 'Device_Format_3']
...
};
After you've created your media info, you're ready to load your media.
To load your media, call the loadMedia
API.
The loadMedia
method returns a promise, since it's an asynchronous operation that accesses a server. When the promise has been resolved, you can manipulate the player as follows:
player.loadMedia(mediaInfo).then(() => {
player.play();
});
Click here to see the full loadMedia
API.
In addition to mediaInfo
, you can also pass media options to the loadMedia
API. Those options will override the default options supplied from the backend or those configured in the player.
Example:
const mediaOptions = {
...
poster: 'my/poster/url',
startTime: 30,
...
};
player.loadMedia(mediaInfo, mediaOptions);
Continue to learn how to manage player tracks, events, states and more using the development guides.