1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['./EmbedMedia', 'text!./Mp4Video.html', 'text!./Audio.html'], function (EmbedMedia, Mp4Video, Audio) {
- var extractExtension = function extractExtension(url) {
- var index = url.lastIndexOf('.');
- return index >= 0 ? url.substring(index + 1).toLowerCase() : '';
- };
- var EmbedMediaLoader = function () {
- function EmbedMediaLoader(type) {
- _classCallCheck(this, EmbedMediaLoader);
- this.type = type;
- }
- EmbedMediaLoader.prototype.tryToLoad = function tryToLoad(url) {
- var extension = extractExtension(url);
- var media = null;
- switch (extension) {
- case 'mp4':
- media = new EmbedMedia(url, this.type, Mp4Video);
- break;
- // TODO: quicktime video is disabled because we remove embed tags for security reason causing this media type not to work
- // This needs to be enabled once we do proper validation for the widget content before we save it.
- //case 'mov':
- // media = new EmbedMedia(url, this.type, QuicktimeVideo);
- // break;
- case 'mp3':
- media = new EmbedMedia(url, this.type, Audio, { type: extension });
- break;
- case 'aac':
- media = new EmbedMedia(url, this.type, Audio, { type: extension });
- break;
- case 'm4a':
- media = new EmbedMedia(url, this.type, Audio, { type: 'mp4' });
- break;
- default:
- break;
- }
- return media;
- };
- return EmbedMediaLoader;
- }();
- return EmbedMediaLoader;
- });
- //# sourceMappingURL=EmbedMediaLoader.js.map
|