12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * 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(['underscore', 'doT', './MediaBase', 'text!./Media.html'], function (_, dot, MediaBase, Template) {
- var template = dot.template(Template);
- var EmbedMedia = function (_MediaBase) {
- _inherits(EmbedMedia, _MediaBase);
- function EmbedMedia(url, id, videoTemplate, extraTemplateArguments) {
- _classCallCheck(this, EmbedMedia);
- var _this = _possibleConstructorReturn(this, _MediaBase.apply(this, arguments));
- _this.videoTemplate = dot.template(videoTemplate);
- _this.extraTemplateArguments = extraTemplateArguments || {};
- return _this;
- }
- EmbedMedia.prototype.getDimensions = function getDimensions() {
- return Promise.resolve(null);
- };
- EmbedMedia.prototype.getMarkup = function getMarkup(params) {
- _.extend(params, this.extraTemplateArguments, {
- url: this.url
- });
- return template({
- mediaMarkup: this.videoTemplate(params)
- });
- };
- EmbedMedia.prototype.markupLoaded = function markupLoaded($el /*, mode*/) {
- var _MediaBase$prototype$;
- this.$el = $el;
- (_MediaBase$prototype$ = _MediaBase.prototype.markupLoaded).call.apply(_MediaBase$prototype$, [this].concat(Array.prototype.slice.call(arguments)));
- };
- EmbedMedia.prototype.showAuthoringMode = function showAuthoringMode() {
- var mediaTag = this.$el.find('iframe.youtubePlayer, video, audio');
- if (mediaTag[0]) {
- switch (mediaTag[0].tagName) {
- case 'IFRAME':
- {
- var iFrame = mediaTag[0].contentWindow;
- iFrame.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
- }
- break;
- case 'VIDEO':
- case 'AUDIO':
- // HTML5 Audio/Video APIs
- mediaTag[0].pause();
- break;
- default:
- break;
- }
- }
- var $container = this.$el.find('.mediaContainer');
- $container.removeClass('consume');
- $container.addClass('authoring');
- };
- EmbedMedia.prototype.showConsumeMode = function showConsumeMode() {
- var $container = this.$el.find('.mediaContainer');
- $container.removeClass('authoring');
- $container.addClass('consume');
- };
- return EmbedMedia;
- }(MediaBase);
- return EmbedMedia;
- });
- //# sourceMappingURL=EmbedMedia.js.map
|