Skip to content

Commit

Permalink
fix(FEC-14051): Player v7 | Playlist dash | Errors in consol when pla…
Browse files Browse the repository at this point in the history
…ying playlist with dash player on chrome, edge and safari.
  • Loading branch information
SivanA-Kaltura authored Jul 23, 2024
1 parent 3c8f16f commit 56a00a8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/common/playlist/playlist-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FakeEvent, Utils, EventManager, getLogger } from '@playkit-js/playkit-js';
import { FakeEvent, Utils, EventManager, getLogger, MediaType } from '@playkit-js/playkit-js';
import {
ProviderEntryListObject,
ProviderMediaInfoObject,
Expand Down Expand Up @@ -337,17 +337,19 @@ class PlaylistManager {

const promises: Promise<any>[] = [];

if (this._playlist.items[index - 1]) {
if (this._playlist.items[index - 1]?.sources.type === MediaType.VOD) {
promises.push(this.prepareEntry(index - 1));
}
if (this._playlist.items[index + 1]) {
if (this._playlist.items[index + 1]?.sources.type === MediaType.VOD) {
promises.push(this.prepareEntry(index + 1));
}

Promise.all(promises).then((mediaConfigs) => {
let cachedUrls = [];
for (const mediaConfig of mediaConfigs) {
cachedUrls = cachedUrls.concat(mediaConfig.sources.dash.map((dashSource) => dashSource.url));
if (mediaConfig.sources.dash?.length) {
cachedUrls = cachedUrls.concat(mediaConfig.sources.dash.map((dashSource) => dashSource.url));
}
}

this._player.setCachedUrls(cachedUrls);
Expand Down

0 comments on commit 56a00a8

Please sign in to comment.