Skip to content

Commit

Permalink
fix(FEC-8834): remove scrubber preview if entry is youtube (#206)
Browse files Browse the repository at this point in the history
Do not add scrubber if entry is youtube, as we can't generate it via our API
  • Loading branch information
OrenMe authored Jan 22, 2019
1 parent f691b05 commit a56b4fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/common/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ function isIos(): boolean {
* @return {void}
*/
function maybeSetStreamPriority(player: Player, playerConfig: PartialKPOptionsObject): void {
const source = playerConfig.sources && playerConfig.sources.progressive;
if (source && source[0] && source[0].mimetype === 'video/youtube') {
if (playerConfig.sources && hasYoutubeSource(playerConfig.sources)) {
const playbackConfig = player.config.playback;
let hasYoutube = false;
playbackConfig.streamPriority.forEach(sp => {
Expand All @@ -412,6 +411,16 @@ function maybeSetStreamPriority(player: Player, playerConfig: PartialKPOptionsOb
}
}

/**
* returns true if sources contain youtube video source
* @param {PKSourcesConfigObject} sources - thr sources object
* @returns {boolean} - true if sources contain youtube source
*/
function hasYoutubeSource(sources: PKSourcesConfigObject): boolean {
const source = sources && sources.progressive;
return !!(source && source[0] && source[0].mimetype === 'video/youtube');
}

export {
printSetupMessages,
supportLegacyOptions,
Expand All @@ -427,5 +436,6 @@ export {
getDefaultOptions,
isSafari,
isIos,
maybeSetStreamPriority
maybeSetStreamPriority,
hasYoutubeSource
};
6 changes: 4 additions & 2 deletions src/kaltura-player.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import {EventType as UIEventType} from '@playkit-js/playkit-js-ui';
import {Provider} from 'playkit-js-providers';
import {supportLegacyOptions, maybeSetStreamPriority} from './common/utils/setup-helpers';
import {supportLegacyOptions, maybeSetStreamPriority, hasYoutubeSource} from './common/utils/setup-helpers';
import getLogger from './common/utils/logger';
import {addKalturaParams} from './common/utils/kaltura-params';
import {evaluatePluginsConfig} from './common/plugins/plugins-config';
Expand Down Expand Up @@ -77,7 +77,9 @@ class KalturaPlayer extends FakeEventTarget {
addKalturaPoster(playerConfig.sources, mediaConfig.sources, this._localPlayer.dimensions);
addKalturaParams(this, playerConfig);
maybeSetStreamPriority(this, playerConfig);
this._uiWrapper.setSeekbarConfig(mediaConfig, this._localPlayer.config.ui);
if (!hasYoutubeSource(playerConfig.sources)) {
this._uiWrapper.setSeekbarConfig(mediaConfig, this._localPlayer.config.ui);
}
this.configure(playerConfig);
}

Expand Down

0 comments on commit a56b4fc

Please sign in to comment.