{"version":3,"sources":["webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe/index.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe/enums.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe/get-api-state.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe/messages.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe/map-old-layout-options.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/util/api-origin.js","webpack://mediasite-player/../GitLabRunner/builds/bLKQ7Rtz/0/sonic-foundry/engineering/mediasite/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/iframe.js"],"names":["BROKER_ACTIVATION_DATA","Object","freeze","version","supports","application","PlayState","Undefined","Stopped","Paused","Playing","ScanForward","ScanReverse","Buffering","Waiting","MediaEnded","Transitioning","Ready","Reconnecting","Closed","Error","Opening","PlayerState","NotReady","InteractionRequired","Ended","ErrorCode","MethodNotFound","MethodError","MediaError","MediaNotSupported","PlayerNotReady","MediaPlayFailed","getApiState","player","readyDependentState","ready","playState","getPlayState","playerState","getPlayerState","currentTime","duration","volume","muted","playbackRate","independentState","liveStatus","live","status","chapters","getAll","map","cue","title","text","time","startTime","getMediasiteChapter","timedevents","timedEvents","slides","captions","get","endTime","getMediasiteCaption","links","metadata","supportingLinks","pollsUri","polls","url","allStreams","visibleStreamTypes","pastSessionPlayedSegments","fullscreenInvocationType","assign","paused","readyState","HTMLMediaElement","HAVE_NOTHING","HAVE_ENOUGH_DATA","networkState","NETWORK_LOADING","410","411","500","510","511","520","530","PREFIX","OUTGOING","INCOMING","mapOldLayoutOptions","options","presentationData","quizzesEnabled","Presentation","presentationOptions","commandMapping","AllowAskQuestion","value","askAQuestion","enabled","ForumEnabled","AllowChapterNavigation","showChapterList","AllowDownloads","downloads","AllowFullscreen","settings","enableFullScreen","AllowHelp","help","playerOptions","AllowPlayPauseStop","enablePlayPause","AllowPolls","PollingEnabled","AllowPopout","popout","PopOutBehavior","AllowScrubbing","enableSeeking","AllowShare","share","SharingEnabled","AllowSpeedControl","enableSpeedControl","EnablePIP","enablePIP","EnablePresentationInfo","showControlBarButton","EnableSearch","search","HasSearchableText","ShowDateTime","showPublishDateTime","ShowHeaderArea","banner","src","behavior","ShowMainControls","controls","ShowStateMessages","endedEnabled","Margin","BackgroundColor","backgroundColor","mappedLayoutOptions","entries","reduce","all","key","mappedCommandFn","push","merged","deepmerge","Origin","scheme","host","port","this","parseOrigin","originString","matches","o","toLowerCase","test","toString","exec","getNullOrigin","CompositeOriginMatcher","matchers","match","originStringToTest","i","length","addMatcher","matcher","StandardOriginMatcher","myOrigin","defaultPortLookup","effectivePort","origin","otherOriginString","otherOrigin","doPortsMatch","BoringOriginMatcher","matchReturnValue","createOriginMatcher","s","wildcardSchemes","isNullOrigin","isUniversalOrigin","prototype","_allowedOrigins","WeakMap","IFramePlugin","videojs","constructor","super","log","init","allowedOrigins","Array","isArray","allowedPlayerIFrameAPISites","slice","set","handleMessageEvent","bind","window","addEventListener","isAllowedBrokerOrigin","establishedBrokerOrigin","allowedBrokerSites","findMatchingOrigin","needleOrigin","haystackSites","allowedOriginMatcher","originArray","composite","createOriginMatcherFromList","indexOf","dispose","removeEventListener","loader","playCoverLoaded","one","on","state","isLive","usingPlugin","PresentationStatus","isMuted","currentRate","event","currentCaptions","mediasiteCaptions","currentChapter","chapterTime","chapterTitle","timedEvent","id","type","payload","timedEventId","timedEventTime","timedEventType","timedEventPayload","error","errorCode","code","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","details","message","data","source","sourceWindow","sourceOrigin","parsedData","fullPrefix","SyntaxError","jsonData","substring","JSON","parse","parseMessage","err","command","params","description","parent","postMessage","messageData","stringify","buildMessage","e","presentationLoaded","waiting","hasClass","loadPresentation","then","quizzes","mappedOptions","applyPlayerOptions","play","pause","parseFloat","seconds","rate","add","remove","color","existingOptions","timelineMarkers","existingTimedEvent","update","label","htmlString","playCoverCustomComponent","contentEl","innerHTML","sanitizeHtmlString","playcover","setPlaycoverCustomContent","dimmed"],"mappings":"8KAKO,MAAMA,EAAyBC,OAAOC,OAAO,CAChDC,QAASF,OAAOC,OAAO,CACnBC,QAAS,OACTC,SAAU,CAAC,QAAS,QAAS,QAAS,SAAU,MAAO,SAAU,SAAU,MAAO,QAAS,SAAU,QAAS,QAC9GC,YAAa,sBCTRC,EAAYL,OAAOC,OAAO,CACnCK,UAAW,YACXC,QAAS,UACTC,OAAQ,SACRC,QAAS,UACTC,YAAa,cACbC,YAAa,cACbC,UAAW,YACXC,QAAS,UACTC,WAAY,aACZC,cAAe,gBACfC,MAAO,QACPC,aAAc,eACdC,OAAQ,SACRC,MAAO,QACPC,QAAS,YAGAC,EAAcrB,OAAOC,OAAO,CACrCqB,SAAU,WACVC,oBAAqB,sBACrBV,QAAS,UACTJ,QAAS,UACTD,OAAQ,SACRD,QAAS,UACTiB,MAAO,QACPL,MAAO,UAGEM,EAAYzB,OAAOC,OAAO,CACnCyB,eAAgB,IAChBC,YAAa,IAEbC,WAAY,IACZC,kBAAmB,IACnBC,eAAgB,IAChBC,gBAAiB,MClCd,SAASC,EAAYC,GAAQ,MAChC,MAAMC,EAAsB,CACxBC,OAAO,EACPC,UAAWC,EAAaJ,GACxBK,YAAaC,EAAeN,GAC5BO,YAAaP,EAAOO,cACpBC,S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,KAAKjI,OAAOmR,YAAYC,0BAA0BL,EAA0B,GAC5E9I,KAAKjI,OAAOmR,YAAYE,QAAS,EAErC,MAEJ,IAAK,mBAAoB,CACrB,MAAM,QAAExN,GAAYoL,EAAO,GAC3BhH,KAAKjI,OAAOkM,SAAS0D,mBAAmBC,MAAM/L,IAC1C,IAAIC,EAEAA,EADAkE,KAAKjI,OAAOwM,YAAY,WACPvE,KAAKjI,OAAO8P,UAAUpK,cAGtB,KAErB,MAAMqK,EAAgBnM,EAAoBC,EAASC,EAAkBC,IACrEiM,OAAmB/H,KAAKjI,OAAQ+P,MAEpC,MAEJ,QACI,EAAA9H,KAAA,WAAAA,KAAgBzI,EAAUC,eAAgB,CACtCuP,UACAC","file":"iframe.cd236f17852287d9ed47.js","sourcesContent":["export { parseMessage, buildMessage } from './messages.js';\r\nexport { getApiState } from './get-api-state.js';\r\nexport { PlayState, PlayerState, ErrorCode, ErrorDescription } from './enums.js';\r\nexport { mapOldLayoutOptions } from './map-old-layout-options.js';\r\n\r\nexport const BROKER_ACTIVATION_DATA = Object.freeze({\r\n version: Object.freeze({\r\n version: '8.12',\r\n supports: [\"6.1.5\", \"6.1.7\", \"6.1.9\", \"6.1.11\", \"7.0\", \"7.0.28\", \"7.0.29\", \"7.2\", \"7.2.2\", \"7.2.2a\", \"7.4.0\", \"8.12\"],\r\n application: 'MediasitePlayer'\r\n })\r\n});\r\n","export const PlayState = Object.freeze({\r\n Undefined: 'undefined',\r\n Stopped: 'stopped',\r\n Paused: 'paused',\r\n Playing: 'playing',\r\n ScanForward: 'scanforward',\r\n ScanReverse: 'scanreverse',\r\n Buffering: 'buffering',\r\n Waiting: 'waiting',\r\n MediaEnded: 'mediaended',\r\n Transitioning: 'transitioning',\r\n Ready: 'ready',\r\n Reconnecting: 'reconnecting',\r\n Closed: 'closed',\r\n Error: 'error',\r\n Opening: 'opening'\r\n});\r\n\r\nexport const PlayerState = Object.freeze({\r\n NotReady: 'NotReady',\r\n InteractionRequired: 'InteractionRequired',\r\n Waiting: 'Waiting',\r\n Playing: 'Playing',\r\n Paused: 'Paused',\r\n Stopped: 'Stopped',\r\n Ended: 'Ended',\r\n Error: 'Error'\r\n});\r\n\r\nexport const ErrorCode = Object.freeze({\r\n MethodNotFound: 410,\r\n MethodError: 411,\r\n // LoadManifestFailure: 500,\r\n MediaError: 510, // Todo\r\n MediaNotSupported: 511, // Todo\r\n PlayerNotReady: 520, // Todo\r\n MediaPlayFailed: 530 // Todo\r\n});\r\n\r\nexport const ErrorDescription = Object.freeze({\r\n 410: \"API method not found\",\r\n 411: \"Error while calling API method\",\r\n 500: \"Could not load presentation metadata\",\r\n 510: \"Problem with presentation media\",\r\n 511: \"Presentation media is not supported\",\r\n 520: \"Player not ready\",\r\n 530: \"Play was rejected by media element\"\r\n});\r\n","import { PlayState, PlayerState } from './enums.js';\r\n\r\nexport function getApiState(player) {\r\n const readyDependentState = {\r\n ready: true,// playerApi.isReady(), // Todo: would this ever NOT be true? By the time we get to this point in the plugin, the player is already technically ready.\r\n playState: getPlayState(player),\r\n playerState: getPlayerState(player),\r\n currentTime: player.currentTime(),\r\n duration: player.duration(),\r\n volume: player.volume(),\r\n muted: player.muted(),\r\n playbackRate: player.playbackRate()\r\n };\r\n\r\n const independentState = {\r\n ready: true,// playerApi.isReady(), // Todo\r\n playerState: getPlayerState(player),\r\n liveStatus: player.live?.().status,// playerApi.getLiveStatus(),\r\n chapters: player.chapters().getAll().map(cue => getMediasiteChapter(cue)),\r\n timedevents: player.timedEvents().getAll(),// playerApi.getTimedEvents(),\r\n slides: [],// playerApi.getAllSlides(), // Todo - probably empty array since the new player doesn't deal with slides?\r\n captions: player.captions().get('en').map(cue => getMediasiteCaption(cue)),\r\n links: player.metadata().supportingLinks,\r\n pollsUri: player.polls().url,// playerApi.getPollsUri(),\r\n allStreams: [],// playerApi.getAllStreams(), // Todo - probably empty array since the new player uses a single composited stream\r\n visibleStreamTypes: [],// playerApi.getVisibleStreamTypes(), // Todo - probably N/A because of composited video\r\n pastSessionPlayedSegments: [],// playerApi.getPastSessionPlayedSegments(), // Todo - not in public API. Do we use this anywhere?\r\n fullscreenInvocationType: []// playerApi.getFullscreenInvocationType() // Todo - not in public API. Do we use this anywhere?\r\n };\r\n\r\n return Object.assign({}, readyDependentState, independentState);\r\n}\r\n\r\nfunction getPlayState(player) {\r\n let playState = PlayState.Undefined;\r\n\r\n // Stopped\r\n if (player.paused() && (player.readyState() === HTMLMediaElement.HAVE_NOTHING)) {\r\n playState = PlayState.Stopped;\r\n }\r\n\r\n // Paused\r\n if (player.paused() && (player.readyState() === HTMLMediaElement.HAVE_ENOUGH_DATA)) {\r\n playState = PlayState.Paused;\r\n }\r\n\r\n // Playing\r\n else if (!player.paused()) {\r\n playState = PlayState.Playing;\r\n }\r\n\r\n // ScanForward - needed?\r\n // ScanReverse - needed?\r\n // Buffering\r\n // Waiting - waiting vs. buffering?\r\n else if (player.paused() && (player.networkState() === HTMLMediaElement.NETWORK_LOADING)) {\r\n playState = PlayState.Waiting;\r\n }\r\n\r\n // MediaEnded\r\n else if (player.paused() && (player.currentTime() === player.duration())) {\r\n playState = PlayState.MediaEnded;\r\n }\r\n\r\n // Transitioning - needed?\r\n // Ready\r\n // Reconnecting - needed?\r\n // Closed - needed?\r\n // Error\r\n // Opening\r\n\r\n return playState;\r\n}\r\n\r\nfunction getPlayerState(player) {\r\n let playerState = PlayerState.NotReady;\r\n\r\n // InteractionRequired\r\n // Waiting\r\n if (player.networkState() === HTMLMediaElement.NETWORK_LOADING) {\r\n playerState = PlayerState.Waiting;\r\n }\r\n\r\n // Playing\r\n else if (!player.paused()) {\r\n playerState = PlayerState.Playing;\r\n }\r\n // Paused\r\n else if (player.paused()) {\r\n playerState = PlayerState.Paused;\r\n }\r\n\r\n // Stopped\r\n // Ended\r\n else if (player.paused() && (player.currentTime() === player.duration())) {\r\n playerState = PlayerState.Ended;\r\n }\r\n\r\n // Error\r\n\r\n return playerState;\r\n}\r\n\r\n/**\r\n * @param {VTTCue} cue\r\n */\r\nfunction getMediasiteCaption(cue) {\r\n return {\r\n text: cue.text,\r\n time: cue.startTime,\r\n endTime: cue.endTime\r\n }\r\n}\r\n\r\n/**\r\n * @param {VTTCue} cue\r\n */\r\nfunction getMediasiteChapter(cue) {\r\n return {\r\n title: cue.text,\r\n time: cue.startTime\r\n }\r\n}\r\n","const PREFIX = Object.freeze({\r\n OUTGOING: 'Mediasite',\r\n INCOMING: 'MediasitePlayer'\r\n});\r\n\r\nconst DELIMITER = ':';\r\n\r\nexport function parseMessage(message) {\r\n // Expected message: \r\n // messagePrefix + messageDelimiter + JSON.stringify(object)\r\n\r\n var fullPrefix = `${PREFIX.INCOMING}${DELIMITER}`;\r\n\r\n if (message.indexOf(fullPrefix) !== 0) {\r\n throw new SyntaxError(\"Unable to parse message without prefix Mediasite.\");\r\n }\r\n\r\n var jsonData = message.substring(fullPrefix.length);\r\n var data = JSON.parse(jsonData);\r\n\r\n return data;\r\n}\r\n\r\nexport function buildMessage(event, data) {\r\n const messageData = { event, data };\r\n\r\n if (!Array.isArray(data)) {\r\n messageData.data = data ? [data] : [];\r\n }\r\n\r\n return `${PREFIX.OUTGOING}${DELIMITER}${JSON.stringify(messageData)}`;\r\n}\r\n","import deepmerge from 'deepmerge';\r\n\r\nexport function mapOldLayoutOptions(options, presentationData, quizzesEnabled) {\r\n const Presentation = presentationData.presentationOptions\r\n\r\n const commandMapping = {\r\n AllowAskQuestion: value => ({\r\n askAQuestion: {\r\n enabled: (value && Presentation?.ForumEnabled) ?? false\r\n },\r\n }),\r\n AllowChapterNavigation: value => ({\r\n chapters: {\r\n showChapterList: value ?? true,\r\n }\r\n }),\r\n AllowDownloads: value => ({\r\n downloads: {\r\n enabled: value ?? false\r\n }\r\n }),\r\n AllowFullscreen: value => ({\r\n settings: {\r\n enableFullScreen: value ?? true\r\n }\r\n }),\r\n AllowHelp: value => ({\r\n help: {\r\n enabled: value === false ? false : presentationData?.playerOptions?.help?.url ? true : false\r\n }\r\n }),\r\n AllowPlayPauseStop: value => ({\r\n settings: {\r\n enablePlayPause: value ?? true\r\n }\r\n }),\r\n AllowPolls: value => ({\r\n polls: {\r\n enabled: value && Presentation?.PollingEnabled && presentationData?.playerOptions?.polls?.url\r\n }\r\n }),\r\n AllowPopout: value => ({\r\n popout: {\r\n enabled: value\r\n }\r\n }),\r\n PopOutBehavior: value => ({\r\n popout: {\r\n enabled: (value === \"Always\" || value === \"Embedded\")\r\n }\r\n }),\r\n AllowScrubbing: value => ({\r\n settings: {\r\n enableSeeking: !((quizzesEnabled && quizzesEnabled === false) || (!quizzesEnabled && value === false))\r\n }\r\n }),\r\n AllowShare: value => ({\r\n share: {\r\n enabled: value === true && Presentation.SharingEnabled === true\r\n }\r\n }),\r\n AllowSpeedControl: value => ({\r\n settings: {\r\n enableSpeedControl: value ?? true\r\n }\r\n }),\r\n EnablePIP: value => ({\r\n settings: {\r\n enablePIP: value ?? true\r\n }\r\n }),\r\n EnablePresentationInfo: value => ({\r\n metadata: {\r\n showControlBarButton: value ?? true,\r\n }\r\n }),\r\n EnableSearch: value => ({\r\n search: {\r\n enabled: value === true && Presentation?.HasSearchableText === true\r\n }\r\n }),\r\n ShowDateTime: value => ({\r\n metadata: {\r\n showPublishDateTime: value ?? true\r\n }\r\n }),\r\n ShowHeaderArea: value => ({\r\n banner: {\r\n enabled: (value == 'Disabled' || value == false) ? false : presentationData?.playerOptions?.banner?.src ? true : false,\r\n behavior: (value == 'AutoHide' || value == 'Static') ? value : value === true ? 'AutoHide' : 'Disabled'\r\n }\r\n }),\r\n ShowMainControls: value => ({\r\n controls: value ?? true\r\n }),\r\n // ForceBalanced: {},\r\n // :SideBias: {},\r\n ShowStateMessages: value => ({\r\n banner: {\r\n endedEnabled: value\r\n }\r\n }),\r\n Margin: {}, // Todo\r\n // Gutter: {},\r\n // FrameWidth: {},\r\n // FrameColor: {},\r\n // FrameOpacity: {},\r\n BackgroundColor: value => ({\r\n settings: {\r\n backgroundColor: value\r\n }\r\n })\r\n }\r\n const mappedLayoutOptions = Object.entries(options).reduce((all, [key, value]) => {\r\n const mappedCommandFn = commandMapping[key];\r\n if (mappedCommandFn) {\r\n all.push(mappedCommandFn(value));\r\n }\r\n else {\r\n all.push({\r\n [key]: value\r\n });\r\n }\r\n return all;\r\n }, []);\r\n const merged = deepmerge.all(mappedLayoutOptions);\r\n if (merged?.settings?.enableSeeking === false ||\r\n (merged?.settings?.enableSeeking == null && presentationData.playerOptions.settings.enableSeeking === false))\r\n {\r\n if (!merged.search) {\r\n merged.search = {};\r\n }\r\n if (!merged.chapters) {\r\n merged.chapters = {};\r\n }\r\n merged.search.enabled = false;\r\n merged.chapters.showChapterList = false;\r\n }\r\n return merged;\r\n}\r\n","/** This code ported from Mediasite.Player.ApiOrigin.js */\r\n\r\nfunction Origin (scheme, host, port) {\r\n this.scheme = scheme;\r\n this.host = host;\r\n this.port = port;\r\n};\r\nOrigin.prototype = {\r\n toString: function () {\r\n return this.scheme + '://' + this.host + ':' + this.port;\r\n }\r\n};\r\n\r\nfunction parseOrigin (originString) {\r\n var originPattern = /^(?:\\s*)(\\*|[a-z\\d\\-\\+\\.]+)(?:\\:\\/\\/)([a-z\\d\\-\\.]+)(?:\\:{0,1})(\\d*)(?:\\s*)$/g;\r\n var universalOriginPattern = /^(?:\\s*)\\*(?:\\s*)$/g;\r\n var matches;\r\n\r\n originString = originString && originString.toLowerCase();\r\n\r\n if (universalOriginPattern.test(originString)) {\r\n return getUniversalOrigin();\r\n }\r\n\r\n matches = originPattern.exec(originString);\r\n\r\n if (!matches) {\r\n return getNullOrigin();\r\n }\r\n\r\n return new Origin(matches[1], matches[2], matches[3]);\r\n};\r\n\r\nfunction getUniversalOrigin () {\r\n var o = new Origin('*', '*', '*');\r\n o.toString = function () { return '*'; };\r\n return o;\r\n};\r\nfunction isUniversalOrigin (origin) {\r\n return origin && origin.toString && origin.toString() === '*';\r\n};\r\nfunction getNullOrigin () {\r\n var o = new Origin('', '', '');\r\n o.toString = function () { return ''; };\r\n return o;\r\n};\r\nfunction isNullOrigin (origin) {\r\n return origin && origin.toString && origin.toString() === '';\r\n};\r\n\r\nfunction CompositeOriginMatcher () {\r\n var matchers = [];\r\n\r\n this.match = function (originStringToTest) {\r\n var i;\r\n for (i = 0; i < matchers.length; i += 1) {\r\n if (matchers[i].match(originStringToTest)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n\r\n this.addMatcher = function (matcher) {\r\n matchers.push(matcher);\r\n };\r\n}\r\n\r\nfunction StandardOriginMatcher (myOrigin) {\r\n var defaultPortLookup = { 'http': '80', 'https': '443' };\r\n\r\n this.match = function (otherOriginString) {\r\n var otherOrigin = parseOrigin(otherOriginString);\r\n var doPortsMatch = effectivePort(myOrigin) === effectivePort(otherOrigin);\r\n\r\n return myOrigin.scheme === otherOrigin.scheme && myOrigin.host === otherOrigin.host && doPortsMatch;\r\n };\r\n\r\n function effectivePort(origin) {\r\n if (typeof origin.port === 'string' && origin.port.length > 0) {\r\n return origin.port;\r\n }\r\n\r\n if (typeof defaultPortLookup[origin.scheme] === 'string') {\r\n return defaultPortLookup[origin.scheme];\r\n }\r\n\r\n return '';\r\n }\r\n};\r\n\r\nfunction BoringOriginMatcher (matchReturnValue) {\r\n this.match = function (otherOriginString) {\r\n return matchReturnValue;\r\n };\r\n};\r\n\r\n\r\nfunction createOriginMatcher (originString) {\r\n var origin;\r\n var matcher;\r\n var i, o, s;\r\n var wildcardSchemes = ['http', 'https'];\r\n\r\n origin = parseOrigin(originString);\r\n\r\n // Null origin -- return a matcher that NEVER matches.\r\n if (isNullOrigin(origin)) {\r\n return new BoringOriginMatcher(false);\r\n }\r\n\r\n // Universal origin -- return a matcher that ALWAYS matches.\r\n if (isUniversalOrigin(origin)) {\r\n return new BoringOriginMatcher(true);\r\n }\r\n\r\n\r\n // Wildcard Scheme -- return a composite matcher that will match all allowed schemes.\r\n if (origin.scheme === '*') {\r\n matcher = new CompositeOriginMatcher();\r\n for (i = 0; i < wildcardSchemes.length; i += 1) {\r\n o = new Origin(wildcardSchemes[i], origin.host, origin.port);\r\n s = o.toString();\r\n matcher.addMatcher(createOriginMatcher(s));\r\n }\r\n return matcher;\r\n }\r\n\r\n return new StandardOriginMatcher(origin);\r\n};\r\n\r\nfunction createOriginMatcherFromList (originArray) {\r\n var composite = new CompositeOriginMatcher();\r\n var originArray = originArray || [];\r\n var i, matcher;\r\n\r\n for (i = 0; i < originArray.length; i += 1) {\r\n matcher = createOriginMatcher(originArray[i]);\r\n composite.addMatcher(matcher);\r\n }\r\n\r\n return composite;\r\n};\r\n\r\n\r\nexport {\r\n parseOrigin,\r\n isNullOrigin,\r\n isUniversalOrigin,\r\n StandardOriginMatcher,\r\n CompositeOriginMatcher,\r\n createOriginMatcher,\r\n createOriginMatcherFromList\r\n}\r\n","import videojs from 'video.js';\r\nimport { sanitizeHtmlString } from '../../util/SFMP.MiniUtility.js';\r\nimport { parseMessage, buildMessage, getApiState, mapOldLayoutOptions, BROKER_ACTIVATION_DATA, PlayState, PlayerState, ErrorCode } from './iframe/';\r\nimport { applyPlayerOptions } from '../bundled/loader/';\r\nimport { createOriginMatcherFromList } from '../../util/api-origin.js';\r\nimport { PresentationStatus } from '../../api/presentation';\r\n\r\nconst _allowedOrigins = new WeakMap();\r\n\r\nconst _universalOrigin = '*';\r\nconst _nonStandardOrigin = 'null'; // If the origin in question is not a scheme/host/port tuple, then return the literal string \"null\" and abort these steps. http://www.w3.org/TR/html5/origin-0.html#unicode-serialization-of-an-origin\r\n\r\n/**\r\n * The IFrame module.

\r\n * Note: this module is optional and might not be available on every MediasitePlayer instance.\r\n * @member {IFramePlugin|undefined} iframe\r\n * @memberof MediasitePlayer#\r\n */\r\n\r\n/**\r\n * Relays player events to a parent window, and listens for messages from that parent.\r\n * @hideconstructor\r\n * @extends {external:\"videojs.Plugin\"}\r\n **/\r\nclass IFramePlugin extends videojs.getPlugin('plugin') {\r\n /**\r\n * \r\n * @param {videojs.Player} player\r\n * @param {Object} [options]\r\n */\r\n constructor(player, options) {\r\n super(player, options);\r\n this.log('Loaded iframe plugin.'); \r\n }\r\n\r\n /**\r\n * Initializes the IFrame plugin.\r\n * @param {Object} options\r\n * @param {Array} options.allowedPlayerIFrameAPISites\r\n */\r\n init(options) {\r\n const allowedOrigins = Array.isArray(options.allowedPlayerIFrameAPISites) && options.allowedPlayerIFrameAPISites.length && options.allowedPlayerIFrameAPISites.slice() || _universalOrigin;\r\n _allowedOrigins.set(this, allowedOrigins);\r\n\r\n this.#registerPlayerListeners();\r\n\r\n this.handleMessageEvent = this.#handleMessageEvent.bind(this);\r\n window.addEventListener('message', this.handleMessageEvent);\r\n }\r\n\r\n /**\r\n * Returns true if communication is allowed with a parent window of the given origin; otherwise, returns false.\r\n * @param {string} origin\r\n * @param {string} [establishedBrokerOrigin]\r\n * @returns {boolean}\r\n */\r\n isAllowedBrokerOrigin(origin, establishedBrokerOrigin) {\r\n const allowedBrokerSites = _allowedOrigins.get(this);\r\n\r\n var matchedOrigin;\r\n\r\n if (establishedBrokerOrigin) {\r\n if (establishedBrokerOrigin == _universalOrigin) {\r\n matchedOrigin = establishedBrokerOrigin;\r\n } else {\r\n matchedOrigin = (establishedBrokerOrigin == origin) && origin;\r\n }\r\n } else {\r\n matchedOrigin = this.findMatchingOrigin(origin, allowedBrokerSites);\r\n }\r\n\r\n return !(!matchedOrigin);\r\n }\r\n\r\n /**\r\n * Checks for a matching origin.\r\n * @param {string} needleOrigin\r\n * @param {Array} haystackSites\r\n * @returns {string}\r\n */\r\n findMatchingOrigin(needleOrigin, haystackSites) {\r\n var allowedOriginMatcher = createOriginMatcherFromList(haystackSites);\r\n var isAllowed = allowedOriginMatcher.match(needleOrigin);\r\n\r\n if (allowedOriginMatcher.match(needleOrigin)) {\r\n if (needleOrigin === _nonStandardOrigin || needleOrigin.indexOf('file:') == 0) { // for sending messages when window.document.location.protocol = file:\r\n return _universalOrigin;\r\n }\r\n\r\n return needleOrigin;\r\n }\r\n }\r\n\r\n #registerPlayerListeners() {\r\n //playcoverready\r\n if (this.player.loader().playCoverLoaded) {\r\n this.#handlePlayCoverLoaded();\r\n }\r\n else {\r\n this.one(this.player, 'playcoverloaded', this.#handlePlayCoverLoaded);\r\n }\r\n\r\n this.one(this.player, 'playcoverclick', () => this.#sendMessage('playcoverclick'));\r\n\r\n this.one(this.player, 'loadstart', this.#handleLoadStart);\r\n this.one(this.player, 'presentationloaded', this.#handlePresentationLoaded);\r\n\r\n //playstatechanged, playerstatechanged\r\n this.on(this.player, 'pause', this.#handlePause);\r\n this.on(this.player, 'playing', this.#handlePlaying);\r\n this.on(this.player, 'ended', this.#handlePresentationEnded);\r\n\r\n //livestatuschanged\r\n this.on(this.player, 'livestatuschanged', this.#handleLiveStatusChanged);\r\n\r\n //volumechanged\r\n this.on(this.player, 'volumechange', this.#handleVolumeChange);\r\n\r\n //currenttimechanged\r\n this.on(this.player, 'timeupdate', this.#handleTimeUpdate);\r\n\r\n //durationchanged\r\n this.on(this.player, 'durationchange', this.#handleDurationChange);\r\n\r\n //playbackratechanged\r\n this.on(this.player, 'ratechange', this.#handleRateChange);\r\n\r\n //captionchanged\r\n this.on(this.player, 'captionchanged', this.#handleCaptionChange);\r\n\r\n //chapterchanged\r\n this.on(this.player, 'chapterchanged', this.#handleChapterChange);\r\n\r\n //timedeventlistchanged\r\n //timedeventreached\r\n this.on(this.player, 'timedeventreached', this.#handleTimeEventReached);\r\n\r\n this.on(this.player, 'error', this.#handleError);\r\n\r\n //slidechanged\r\n //slideadded\r\n //visiblestreamschanged\r\n //fullscreeninvocationtypechanged\r\n //externalisfullscreenchanged\r\n }\r\n\r\n #handlePlayCoverLoaded() {\r\n this.#sendMessage('playcoverready')\r\n }\r\n\r\n #handleLoadStart() {\r\n this.#sendMessage('_broker_activated', BROKER_ACTIVATION_DATA);\r\n this.#sendMessage('_api_state', getApiState(this.player));\r\n\r\n this.#handleVolumeChange();\r\n //this.#handleRateChange();\r\n // Todo: visiblestreamschanged\r\n // Todo: slidechanged\r\n \r\n }\r\n\r\n #handlePresentationLoaded() {\r\n this.#sendMessage('_api_state', getApiState(this.player));\r\n this.#sendMessage('ready');\r\n this.#handleLiveStatusChanged(); // Legacy player sent livestatuschanged event after ready on live presentations\r\n }\r\n\r\n #handlePause() {\r\n this.#sendMessage('playstatechanged', { playState: PlayState.Paused });\r\n this.#sendMessage('playerstatechanged', { state: PlayerState.Paused, isLive: this.player.usingPlugin('live') });\r\n }\r\n\r\n #handlePlaying() {\r\n this.#sendMessage('playstatechanged', { playState: PlayState.Playing });\r\n this.#sendMessage('playerstatechanged', { state: PlayerState.Playing, isLive: this.player.usingPlugin('live') });\r\n }\r\n\r\n #handlePresentationEnded() {\r\n this.#sendMessage('playstatechanged', { playState: PlayState.MediaEnded });\r\n this.#sendMessage('playerstatechanged', { state: PlayerState.Ended, isLive: this.player.usingPlugin('live') });\r\n }\r\n\r\n #handleLiveStatusChanged() {\r\n this.player.ready(() => {\r\n let liveStatus;\r\n\r\n //if we're not live, return the 'On Demand' state for the live status\r\n if (this.player.live == null) {\r\n liveStatus = PresentationStatus.OnDemand;\r\n } else {\r\n liveStatus = this.player.live?.().status;\r\n }\r\n\r\n if (liveStatus) {\r\n this.#sendMessage('livestatuschanged', { liveStatus });\r\n }\r\n });\r\n }\r\n\r\n #handleVolumeChange() {\r\n this.#sendMessage('volumechanged', { volume: this.player.volume() * 100, isMuted: this.player.muted() }); // API expects a percent from 1-100%\r\n }\r\n\r\n #handleTimeUpdate() {\r\n this.#sendMessage('currenttimechanged', { currentTime: this.player.currentTime() })\r\n }\r\n\r\n #handleDurationChange() {\r\n this.#sendMessage('durationchanged', { duration: this.player.duration() });\r\n }\r\n\r\n #handleRateChange() {\r\n this.#sendMessage('playbackratechanged', { currentRate: this.player.playbackRate() });\r\n }\r\n\r\n /**\r\n * \r\n * @param {any} event\r\n * @param {VTTCue[]} currentCaptions\r\n */\r\n #handleCaptionChange(event, currentCaptions) {\r\n const mediasiteCaptions = currentCaptions.map(cue => ({\r\n time: cue.startTime,\r\n endTime: cue.endTime,\r\n text: cue.text\r\n }))\r\n this.#sendMessage('captionchanged', { currentCaptions: mediasiteCaptions });\r\n }\r\n\r\n #handleChapterChange(event, currentChapter) {\r\n this.#sendMessage('chapterchanged', {\r\n chapterTime: currentChapter?.startTime ?? null,\r\n chapterTitle: currentChapter?.text ?? null\r\n });\r\n }\r\n\r\n #handleTimeEventReached(event, timedEvent) {\r\n const { id, time, type, payload } = timedEvent;\r\n this.#sendMessage('timedeventreached', {\r\n timedEventId: id,\r\n timedEventTime: time,\r\n timedEventType: type,\r\n timedEventPayload: payload\r\n });\r\n }\r\n\r\n #handleError(event) {\r\n const error = this.player.error();\r\n let errorCode;\r\n\r\n switch (error?.code) {\r\n case MediaError.MEDIA_ERR_ABORTED:\r\n case MediaError.MEDIA_ERR_NETWORK:\r\n break;\r\n case MediaError.MEDIA_ERR_DECODE:\r\n errorCode = ErrorCode.MediaPlayFailed;\r\n break;\r\n case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:\r\n errorCode = ErrorCode.MediaNotSupported;\r\n break;\r\n default:\r\n errorCode = ErrorCode.MediaError;\r\n break;\r\n }\r\n\r\n if (errorCode) {\r\n this.#sendError(errorCode, {\r\n details: error?.message\r\n });\r\n }\r\n \r\n }\r\n\r\n #handleMessageEvent(event) {\r\n const { data, source: sourceWindow, origin: sourceOrigin } = event;\r\n const isAllowedOrigin = this.isAllowedBrokerOrigin(sourceOrigin);\r\n\r\n if (isAllowedOrigin) {\r\n //First, see if the message is even for the iframe plugin\r\n let parsedData;\r\n try {\r\n parsedData = parseMessage(data);\r\n }\r\n catch (err) {\r\n this.log(err.message);\r\n return;\r\n }\r\n //then, if it is, figure out what command to run\r\n const { command, params } = parsedData;\r\n try { \r\n this.#handleCommand(command, params);\r\n }\r\n catch (err) {\r\n this.#sendError(ErrorCode.MethodError, {\r\n details: err.message || err.description || err,\r\n command,\r\n params\r\n });\r\n }\r\n }\r\n }\r\n\r\n #sendMessage(message, data) {\r\n if (window.parent && window.parent.postMessage) {\r\n try {\r\n window.parent.postMessage(buildMessage(message, data), '*');\r\n }\r\n catch (e) {\r\n this.log('Unable to communicate with the Mediasite IFrame API: ');\r\n this.log.error(e);\r\n }\r\n }\r\n }\r\n\r\n #sendError(errorCode, data) {\r\n this.#sendMessage('error', { errorCode, ...data });\r\n }\r\n\r\n #handleCommand(command, params) {\r\n this.log(`IFrame API received command \"${command}\" with params: ${JSON.stringify(params)}`);\r\n const presentationLoaded = this.player.loader().presentationLoaded;\r\n const waiting = this.player.hasClass('vjs-waiting');\r\n if (waiting && !presentationLoaded) {\r\n if (command == 'setLayoutOptions') {\r\n const { options } = params[0];\r\n this.player.loader().loadPresentation().then((presentationData) => {\r\n let quizzesEnabled\r\n if (this.player.usingPlugin('quizzes')) {\r\n quizzesEnabled = this.player.quizzes().enableSeeking;\r\n }\r\n else {\r\n quizzesEnabled = null;\r\n }\r\n const mappedOptions = mapOldLayoutOptions(options, presentationData, quizzesEnabled);\r\n applyPlayerOptions(this.player, mappedOptions);\r\n });\r\n }\r\n else {\r\n this.#sendError(ErrorCode.PlayerNotReady);\r\n }\r\n }\r\n else {\r\n switch (command) {\r\n case 'play': {\r\n if (presentationLoaded) {\r\n this.player.play();\r\n }\r\n else {\r\n this.player.loader().loadPresentation();\r\n this.player.play();\r\n }\r\n break;\r\n }\r\n case 'pause': {\r\n if (presentationLoaded) {\r\n this.player.pause();\r\n }\r\n break;\r\n }\r\n case 'stop': {\r\n if (presentationLoaded) {\r\n this.player.pause();\r\n }\r\n break;\r\n }\r\n case 'seekTo': {\r\n if (presentationLoaded) {\r\n const time = parseFloat(params[0]?.seconds);\r\n this.player.currentTime(time);\r\n }\r\n break;\r\n }\r\n case 'setVolume': {\r\n if (presentationLoaded) {\r\n const { volume } = params[0];\r\n this.player.volume(volume / 100); // API sends values from 0-100%, but the player needs 0.0-1.0\r\n }\r\n break;\r\n }\r\n case 'setPlaybackRate': {\r\n if (presentationLoaded) {\r\n const { rate } = params[0];\r\n this.player.playbackRate(rate);\r\n }\r\n break;\r\n }\r\n case 'mute': {\r\n if (presentationLoaded) {\r\n this.player.muted(true);\r\n }\r\n break;\r\n }\r\n case 'unMute': {\r\n if (presentationLoaded) {\r\n this.player.muted(false);\r\n }\r\n break;\r\n }\r\n case 'unsafeAddTimedEvent': {\r\n if (presentationLoaded) {\r\n const { time, type, payload, id } = params[0];\r\n this.player.timedEvents().add({\r\n id,\r\n time,\r\n type,\r\n payload\r\n });\r\n }\r\n break;\r\n }\r\n case 'removeTimedEvent': {\r\n if (presentationLoaded) {\r\n const { id } = params[0];\r\n this.player.timedEvents().remove(id);\r\n }\r\n break;\r\n }\r\n case 'setTimedEventMarkerOptions': {\r\n if (presentationLoaded) {\r\n const [id, { color, text }] = params;\r\n const existingOptions = this.player.timelineMarkers().get(id);\r\n const existingTimedEvent = this.player.timedEvents().get(id);\r\n if (typeof existingOptions === 'object') {\r\n this.player.timelineMarkers().update(id, { color: color, label: text });\r\n } else if (typeof existingTimedEvent === 'object') {\r\n this.player.timelineMarkers().add({ id: id, time: existingTimedEvent.time, label: text, color: color });\r\n }\r\n }\r\n break;\r\n }\r\n case 'clearTimedEventMarkerOptions': {\r\n if (presentationLoaded) {\r\n const [id] = params;\r\n const existingOptions = this.player.timelineMarkers().get(id);\r\n this.player.timelineMarkers().remove(id);\r\n }\r\n break;\r\n }\r\n case 'setPlayCoverCustomHtml': {\r\n if (!(presentationLoaded || waiting)) {\r\n const { htmlString } = params[0];\r\n\r\n const Component = videojs.getComponent('Component');\r\n const playCoverCustomComponent = new Component(this.player);\r\n playCoverCustomComponent.contentEl().innerHTML = sanitizeHtmlString(htmlString);\r\n\r\n this.player.playcover().setPlaycoverCustomContent(playCoverCustomComponent, 0);\r\n this.player.playcover().dimmed = true;\r\n }\r\n break;\r\n }\r\n case 'setLayoutOptions': {\r\n const { options } = params[0];\r\n this.player.loader().loadPresentation().then((presentationData) => {\r\n let quizzesEnabled\r\n if (this.player.usingPlugin('quizzes')) {\r\n quizzesEnabled = this.player.quizzes().enableSeeking;\r\n }\r\n else {\r\n quizzesEnabled = null;\r\n }\r\n const mappedOptions = mapOldLayoutOptions(options, presentationData, quizzesEnabled);\r\n applyPlayerOptions(this.player, mappedOptions);\r\n });\r\n break;\r\n }\r\n default: {\r\n this.#sendError(ErrorCode.MethodNotFound, {\r\n command,\r\n params\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n dispose() {\r\n window.removeEventListener('message', this.handleMessageEvent);\r\n }\r\n}\r\n\r\nexport { IFramePlugin };\r\n"],"sourceRoot":""}