Skip to content

Commit

Permalink
fix(FEC-8581): playlist by config, no playlist buttons in first video (
Browse files Browse the repository at this point in the history
…#171)

**issue:** when the playlist is by config, the first items selected **while** the playlist construction, so in this moment `this.player.playlist` is `undefined`.
**solution:** config the playlist **after** the its construction
  • Loading branch information
yairans committed Nov 13, 2018
1 parent cc2f8f2 commit 5e1ab92
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
33 changes: 19 additions & 14 deletions samples/ovp/playlist-by-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<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 = {
Expand All @@ -21,30 +19,37 @@
serviceUrl: "http://qa-apache-php7.dev.kaltura.com/api_v3"
}
},
playback: {
autoplay: true
},
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: {
poster: 'http://cdntesting.qa.mkaltura.com/p/1091/sp/109100/thumbnail/entry_id/0_fu4ifhie/version/100002/height/360/width/640',
hls: [
{
id: "id1",
mimetype: "application/x-mpegURL",
url: "http://qa-apache-php7.dev.kaltura.com/p/1091/sp/109100/playManifest/entryId/0_fu4ifhie/protocol/http/format/applehttp/flavorIds/0_wbawecj0,0_cj2odpyt,0_uj45vim0,0_xlpm7btj,0_6p25la0i,0_cmq5aigy/a.m3u8"
}
]
}
},
{
sources: {
metadata: {
name: 'my second entry'
},
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"
url: "http://qa-apache-php7.dev.kaltura.com/p/1091/sp/109100/playManifest/entryId/0_15xrxwvo/protocol/http/format/applehttp/flavorIds/0_io24exzg,0_5r0geh30,0_b647tbfs,0_fzqa9ew4/a.m3u8"
}
]
}
Expand All @@ -55,7 +60,7 @@
{
id: "id3",
mimetype: "application/x-mpegURL",
url: "https://demo.deltatre.it/cc-test/QualityLevels(1400000)/Manifest(video,format=m3u8-aapl).m3u8"
url: "http://qa-apache-php7.dev.kaltura.com/p/1091/sp/109100/playManifest/entryId/0_p8aigvgu/protocol/http/format/applehttp/flavorIds/0_80115tmg/a.m3u8"
}
]
}
Expand Down
2 changes: 0 additions & 2 deletions samples/ovp/playlist-by-entry-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<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 = {
Expand Down
4 changes: 1 addition & 3 deletions samples/ovp/playlist-by-id.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<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 = {
Expand All @@ -26,7 +24,7 @@

try {
var kalturaPlayer = KalturaPlayer.setup(config);
kalturaPlayer.loadPlaylist({playlistId: '0_jr7vpj0w'}, {options: {autoContinue: false}});
kalturaPlayer.loadPlaylist({playlistId: '0_jr7vpj0w'});
} catch (e) {
console.error(e.message)
}
Expand Down
1 change: 0 additions & 1 deletion src/common/playlist/playlist-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class PlaylistManager {
this._options = {autoContinue: true};
this._countdown = {duration: 10, showing: true};
this._playerOptions = options;
this.configure(this._playerOptions.playlist);
this.addBindings();
}

Expand Down
1 change: 1 addition & 0 deletions src/kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class KalturaPlayer extends FakeEventTarget {
this._uiWrapper = new UIWrapper(this, options);
this._provider = new Provider(options.provider, __VERSION__);
this._playlistManager = new PlaylistManager(this, options);
this._playlistManager.configure(options.playlist);
Object.values(CoreEventType).forEach(coreEvent => this._eventManager.listen(this._localPlayer, coreEvent, e => this.dispatchEvent(e)));
}

Expand Down

0 comments on commit 5e1ab92

Please sign in to comment.