Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Module - Add JW Player Submodule #5

Merged
merged 17 commits into from
Aug 18, 2021
51 changes: 51 additions & 0 deletions modules/videoModule/constants/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Life Cycle
export const SETUP_COMPLETE = 'setupComplete';
export const SETUP_FAILED = 'setupFailed';
export const DESTROYED = 'destroyed';

// Ads
export const AD_REQUEST = 'adRequest';
export const AD_BREAK_START = 'adBreakStart';
export const AD_LOADED = 'adLoaded';
export const AD_STARTED = 'adStarted';
export const AD_IMPRESSION = 'adImpression';
export const AD_PLAY = 'adPlay';
export const AD_TIME = 'adTime';
export const AD_PAUSE = 'adPause';
export const AD_CLICK = 'adClick';
export const AD_SKIPPED = 'adSkipped';
export const AD_ERROR = 'adError';
export const AD_COMPLETE = 'adComplete';
export const AD_BREAK_END = 'adBreakEnd';

// Media
export const PLAYLIST = 'playlist';
export const PLAYBACK_REQUEST = 'playbackRequest';
export const AUTOSTART_BLOCKED = 'autostartBlocked';
export const PLAY_ATTEMPT_FAILED = 'playAttemptFailed';
export const CONTENT_LOADED = 'contentLoaded';
export const PLAY = 'play';
export const PAUSE = 'pause';
export const BUFFER = 'buffer';
export const TIME = 'time';
export const SEEK_START = 'seekStart';
export const SEEK_END = 'seekEnd';
export const MUTE = 'mute';
export const VOLUME = 'volume';
export const RENDITION_UPDATE = 'renditionUpdate';
export const ERROR = 'error';
export const COMPLETE = 'complete';
export const PLAYLIST_COMPLETE = 'playlistComplete';

// Layout
export const FULLSCREEN = 'fullscreen';
export const PLAYER_RESIZE = 'playerResize';
export const VIEWABLE = 'viewable';
export const CAST = 'cast';

// Param options
export const PLAYBACK_MODE = {
VOD: 0,
LIVE: 1,
DVR: 2
};
66 changes: 66 additions & 0 deletions modules/videoModule/constants/ortb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

const VIDEO_PREFIX = 'video/'

/*
ORTB 2.5 section 3.2.7 - Video.mimes
*/
export const VIDEO_MIME_TYPE = {
MP4: VIDEO_PREFIX + 'mp4',
MPEG: VIDEO_PREFIX + 'mpeg',
OGG: VIDEO_PREFIX + 'ogg',
WEBM: VIDEO_PREFIX + 'webm',
AAC: VIDEO_PREFIX + 'aac',
HLS: 'application/vnd.apple.mpegurl'
};

export const JS_APP_MIME_TYPE = 'application/javascript';
export const VPAID_MIME_TYPE = JS_APP_MIME_TYPE;

/*
ORTB 2.5 section 5.9 - Video Placement Types
*/
export const PLACEMENT = {
IN_STREAM: 1,
BANNER: 2,
ARTICLE: 3,
FEED: 4,
INTERSTITIAL: 5,
SLIDER: 5,
FLOATING: 5,
INTERSTITIAL_SLIDER_FLOATING: 5
};

/*
ORTB 2.5 section 5.10 - Playback Methods
*/
export const PLAYBACK_METHODS = {
AUTOPLAY: 1,
AUTOPLAY_MUTED: 2,
CLICK_TO_PLAY: 3,
CLICK_TO_PLAY_MUTED: 4,
VIEWABLE: 5,
VIEWABLE_MUTED: 6
};

/*
ORTB 2.5 section 5.8 - Protocols
*/
export const PROTOCOLS = {
// VAST_1_0: 1,
VAST_2_0: 2,
VAST_3_0: 3,
// VAST_1_O_WRAPPER: 4,
VAST_2_0_WRAPPER: 5,
VAST_3_0_WRAPPER: 6,
VAST_4_0: 7,
VAST_4_0_WRAPPER: 8
};

/*
ORTB 2.5 section 5.6 - API Frameworks
*/
export const API_FRAMEWORKS = {
VPAID_1_0: 1,
VPAID_2_0: 2,
OMID_1_0: 7
};
2 changes: 2 additions & 0 deletions modules/videoModule/constants/vendorCodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const JWPLAYER_VENDOR = 1;
export const VIDEO_JS_VENDOR = 2;
4 changes: 3 additions & 1 deletion modules/videoModule/coreVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export function VideoSubmoduleBuilder(vendorDirectory_) {
throw new Error('Unrecognized vendor code');
}

return submoduleFactory(providerConfig);
const submodule = submoduleFactory(providerConfig);
submodule.init && submodule.init();
return submodule;
}

return {
Expand Down
21 changes: 21 additions & 0 deletions modules/videoModule/shared/state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default function stateFactory() {
let state = {};

function updateState(stateUpdate) {
Object.assign(state, stateUpdate);
}

function getState() {
return state;
}

function clearState() {
state = {};
}

return {
updateState,
getState,
clearState
};
}
Loading