Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 1x 1x 1x 1x 6x 4x 1x 1x 2x 1x 1x 1x 1x | import isEmpty from '../../../Shared/Utils/isEmpty';
import deriveMediaType from '../Util/deriveMediaType';
import mapManifestsToSchema from '../Util/mapManifestsToSchema';
import mapManifestsToRecommendedCdns from '../Util/mapManifestsToRecommendedCdns';
const subscribeToPlaybackApiResponse = (
playbackApiResponse$,
playbackStore,
precisionStore,
) =>
playbackApiResponse$
.subscribe(({
asset,
media,
playbackDetails,
playbackPrecision,
}) => {
Iif (
isEmpty(asset) ||
isEmpty(media) ||
isEmpty(playbackDetails)
) {
return playbackStore.actions.disableFeature();
}
const manifestItems = playbackDetails;
const [firstManifestItem] = manifestItems;
const { isLinear, isLive } = asset;
let manifests = mapManifestsToSchema(manifestItems);
Iif (isEmpty(playbackPrecision)) {
precisionStore.actions.disableFeature();
} else {
manifests = mapManifestsToRecommendedCdns(manifests, playbackPrecision.cdns);
}
playbackStore.actions.updatePlayback({
asset,
media,
manifests,
licenseUrl: firstManifestItem.laUrl,
releasePid: firstManifestItem.releasePid,
mediaType: deriveMediaType(isLinear, isLive),
isEnabled: true,
});
});
export default subscribeToPlaybackApiResponse;
|