-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add playlist api: * `loadPlaylist` - to load playlist from the backend * `loadPlaylistByEntryList` - to load playlist by entry id's * `setPlaylist` * `getter playlist` - for the playlist api (`playNext`, `playPrev` etc.) new classes: `PlaylistManager`, `Playlist` and `PlaylistItem`
- Loading branch information
Showing
24 changed files
with
491 additions
and
62 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @flow | ||
import {PlaylistItem} from '../../src/common/playlist/playlist-item'; | ||
|
||
declare type KPPlaylistConfigObject = { | ||
id: string, | ||
metadata: KPPlaylistMetadata, | ||
options: KPPlaylistOptions, | ||
countdown: KPPlaylistCountdownOptions, | ||
items: Array<PlaylistItem> | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @flow | ||
declare type KPPlaylistCountdownOptions = { | ||
timeToShow?: number, | ||
duration: number, | ||
showing: boolean | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// @flow | ||
declare type KPPlaylistItemConfigObject = { | ||
countdown?: KPPlaylistCountdownOptions; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// @flow | ||
declare type KPPlaylistMetadata = { | ||
name: string, | ||
description: string | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// @flow | ||
declare type KPPlaylistOptions = { | ||
autoContinue: boolean | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | ||
<title>Title</title> | ||
<link rel="stylesheet" type="text/css" href="./style.css"/> | ||
<script src="./kaltura-ovp-player.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<button onclick="kalturaPlayer.playlist.playNext()">Play Next</button> | ||
<button onclick="kalturaPlayer.playlist.playPrev()">Play Prev</button> | ||
<div id="player-placeholder"></div> | ||
<script> | ||
var config = { | ||
targetId: 'player-placeholder', | ||
provider: { | ||
partnerId: 1091, | ||
env: { | ||
cdnUrl: "http://qa-apache-php7.dev.kaltura.com/", | ||
serviceUrl: "http://qa-apache-php7.dev.kaltura.com/api_v3" | ||
} | ||
}, | ||
playlist: { | ||
id: '1234', | ||
metadata: { | ||
name: 'my playlist name', | ||
description: 'my playlist desc' | ||
}, | ||
items: [{ | ||
sources: { | ||
hls: [ | ||
{ | ||
id: "id1", | ||
mimetype: "application/x-mpegURL", | ||
url: "https://sportstv-live.akamaized.net/hlsl/1/Cars_TV/Cars_TV.m3u8" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
sources: { | ||
hls: [ | ||
{ | ||
id: "id2", | ||
mimetype: "application/x-mpegURL", | ||
url: "http://qa-apache-php7.dev.kaltura.com/p/1091/sp/109100/playManifest/entryId/0_wifqaipd/protocol/http/format/applehttp/flavorIds/0_h65mfj7f,0_3flmvnwc,0_m131krws,0_5407xm9j/a.m3u8" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
sources: { | ||
hls: [ | ||
{ | ||
id: "id3", | ||
mimetype: "application/x-mpegURL", | ||
url: "https://demo.deltatre.it/cc-test/QualityLevels(1400000)/Manifest(video,format=m3u8-aapl).m3u8" | ||
} | ||
] | ||
} | ||
}], | ||
countdown: { | ||
duration: 10, | ||
showing: true | ||
} | ||
} | ||
}; | ||
|
||
try { | ||
var kalturaPlayer = KalturaPlayer.setup(config); | ||
} catch (e) { | ||
console.error(e.message) | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | ||
<title>Title</title> | ||
<link rel="stylesheet" type="text/css" href="./style.css"/> | ||
<script src="./kaltura-ovp-player.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<button onclick="kalturaPlayer.playlist.playNext()">Play Next</button> | ||
<button onclick="kalturaPlayer.playlist.playPrev()">Play Prev</button> | ||
<div id="player-placeholder"></div> | ||
<script> | ||
var config = { | ||
targetId: 'player-placeholder', | ||
provider: { | ||
partnerId: 1091, | ||
env: { | ||
cdnUrl: "http://qa-apache-php7.dev.kaltura.com/", | ||
serviceUrl: "http://qa-apache-php7.dev.kaltura.com/api_v3" | ||
} | ||
} | ||
}; | ||
|
||
try { | ||
var kalturaPlayer = KalturaPlayer.setup(config); | ||
kalturaPlayer.loadPlaylistByEntryList({entries: ['0_nwkp7jtx', '0_wifqaipd', '0_nwkp7jtx'], options: {}}); | ||
} catch (e) { | ||
console.error(e.message) | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | ||
<title>Title</title> | ||
<link rel="stylesheet" type="text/css" href="./style.css"/> | ||
<script src="./kaltura-ovp-player.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<button onclick="kalturaPlayer.playlist.playNext()">Play Next</button> | ||
<button onclick="kalturaPlayer.playlist.playPrev()">Play Prev</button> | ||
<div id="player-placeholder"></div> | ||
<script> | ||
var config = { | ||
targetId: 'player-placeholder', | ||
provider: { | ||
partnerId: 1091, | ||
env: { | ||
cdnUrl: "http://qa-apache-php7.dev.kaltura.com/", | ||
serviceUrl: "http://qa-apache-php7.dev.kaltura.com/api_v3" | ||
} | ||
}, | ||
playback: {autoplay: true} | ||
}; | ||
|
||
try { | ||
var kalturaPlayer = KalturaPlayer.setup(config); | ||
kalturaPlayer.loadPlaylist({playlistId: '0_jr7vpj0w'}, {options: {autoContinue: false}}); | ||
} catch (e) { | ||
console.error(e.message) | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @flow | ||
const namespace = 'kaltura-player'; | ||
|
||
const PlaylistEventType: {[event: string]: string} = { | ||
PLAYLIST_LOADED: `${namespace}-playlistloaded`, | ||
PLAYLIST_ITEM_CHANGED: `${namespace}-playlistitemchanged`, | ||
PLAYLIST_ENDED: `${namespace}-playlistended` | ||
}; | ||
|
||
export {PlaylistEventType}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// @flow | ||
class PlaylistItem { | ||
_sources: ?ProviderMediaConfigSourcesObject; | ||
_config: ?KPPlaylistItemConfigObject; | ||
|
||
constructor(sources: ?ProviderMediaConfigSourcesObject, config: ?KPPlaylistItemConfigObject) { | ||
this._sources = sources; | ||
this._config = config; | ||
} | ||
|
||
get sources(): ?ProviderMediaConfigSourcesObject { | ||
return this._sources; | ||
} | ||
|
||
get config(): ?KPPlaylistItemConfigObject { | ||
return this._config; | ||
} | ||
|
||
isPlayable(): boolean { | ||
return !!( | ||
this._sources && | ||
((this._sources.hls && this._sources.hls.length) || | ||
(this._sources.dash && this._sources.dash.length) || | ||
(this._sources.progressive && this._sources.progressive.length)) | ||
); | ||
} | ||
} | ||
|
||
export {PlaylistItem}; |
Oops, something went wrong.