Methods
(async, static) api(mediaId) → {object}
Gets the api data
Parameters:
Name | Type | Description |
---|---|---|
mediaId |
string | The mediaId we're embedding the placeholder for. |
Returns:
object
- Type
- object
Example
import { KalturaPlayerAPI } from '@carbon/ibmdotcom-services';
async function getMyVideoInfo(id) {
const data = await KalturaPlayerAPI.api(id);
console.log(data);
}
(static) checkScript() → {Promise.<*>}
Gets the full _scriptReady state
Returns:
Promise kaltura media player file
- Type
- Promise.<*>
(async, static) embedMedia(mediaId, targetId, flashvars, useIbmMetrics, customReadyCallback) → {object}
Gets the embed meta data
Parameters:
Name | Type | Default | Description |
---|---|---|---|
mediaId |
string | The mediaId we're embedding the placeholder for. |
|
targetId |
string | The targetId the ID where we're putting the placeholder. |
|
flashvars |
object | Determine any extra param or plugin for the player. |
|
useIbmMetrics |
boolean | true | Whether or not should IBM Metrics events be fired. |
customReadyCallback |
function | Determine any extra functions that should be executed on player readyCallback. |
Returns:
object
- Type
- object
Example
import { KalturaPlayerAPI } from '@carbon/ibmdotcom-services';
function embedMyVideo() {
const elem = document.getElementById('foo');
const videoid = '12345';
KalturaPlayerAPI.embedMedia(videoid, elem);
}
(static) fireEvent(param)
Fires a metrics event when the media was played. Pass events to common metrics event.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
param |
object | params Properties
|
(static) getMediaDuration(duration, fromMilliseconds) → {string}
Convert media duration from milliseconds and seconds to HH:MM:SS
Parameters:
Name | Type | Default | Description |
---|---|---|---|
duration |
string | 0 | media duration in seconds |
fromMilliseconds |
boolean | the duration argument is expressed in milliseconds rather than seconds |
Returns:
converted duration
- Type
- string
(static) getThumbnailUrl(params) → {string}
Creates thumbnail image url with customizable params
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | param object Properties
|
Returns:
url of thumbnail image
- Type
- string
Example
import { KalturaPlayerAPI } from '@carbon/ibmdotcom-services';
function thumbnail() {
const thumbnailData = {
mediaId: '1_9h94wo6b',
height: '240',
width: '320'
}
const thumbnailUrl = KalturaPlayerAPI.getThumbnailUrl(thumbnailData);
}