UNPKG

rizzo-next

Version:

The next generation of Lonely Planet's style guide and pattern library.

165 lines (135 loc) 6.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _bane = require("../../core/bane"); 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; } var VideoPlayer = function (_Component) { _inherits(VideoPlayer, _Component); function VideoPlayer() { _classCallCheck(this, VideoPlayer); return _possibleConstructorReturn(this, (VideoPlayer.__proto__ || Object.getPrototypeOf(VideoPlayer)).apply(this, arguments)); } _createClass(VideoPlayer, [{ key: "initialize", value: function initialize(_ref) { var _this2 = this; var playerId = _ref.playerId, _ref$playerName = _ref.playerName, playerName = _ref$playerName === undefined ? "default" : _ref$playerName, _ref$videoId = _ref.videoId, videoId = _ref$videoId === undefined ? null : _ref$videoId, _ref$autoplay = _ref.autoplay, autoplay = _ref$autoplay === undefined ? false : _ref$autoplay, _ref$poster = _ref.poster, poster = _ref$poster === undefined ? null : _ref$poster, _ref$controls = _ref.controls, controls = _ref$controls === undefined ? true : _ref$controls, _ref$seo = _ref.seo, seo = _ref$seo === undefined ? true : _ref$seo, _ref$popout = _ref.popout, popout = _ref$popout === undefined ? false : _ref$popout, _ref$cover = _ref.cover, cover = _ref$cover === undefined ? false : _ref$cover, _ref$muted = _ref.muted, muted = _ref$muted === undefined ? false : _ref$muted, _ref$playsInline = _ref.playsInline, playsInline = _ref$playsInline === undefined ? false : _ref$playsInline, _ref$playWhenInView = _ref.playWhenInView, playWhenInView = _ref$playWhenInView === undefined ? false : _ref$playWhenInView, _ref$pauseWhenOutOfVi = _ref.pauseWhenOutOfView, pauseWhenOutOfView = _ref$pauseWhenOutOfVi === undefined ? false : _ref$pauseWhenOutOfVi, _ref$outOfViewThresho = _ref.outOfViewThreshold, outOfViewThreshold = _ref$outOfViewThresho === undefined ? 0.5 : _ref$outOfViewThresho, _ref$insertPixel = _ref.insertPixel, insertPixel = _ref$insertPixel === undefined ? true : _ref$insertPixel; this.playerId = playerId; this.videoId = videoId; this.autoplay = autoplay; this.poster = poster; this.playerName = playerName; this.seo = seo; this.controls = controls; this.popout = popout; this.cover = cover; this.muted = muted; this.playsInline = playsInline; this.playWhenInView = playWhenInView; this.pauseWhenOutOfView = pauseWhenOutOfView; this.outOfViewThreshold = outOfViewThreshold; this.insertPixel = insertPixel; this.defaultAspectRatio = 1.77777778; this.events = {}; this.isReady = false; this.on("ready", function () { _this2.isReady = true; }); this.setup(); } /** * Use this to change any properties of the player after initialization. * There is very simple default logic for this method and it is expected * that subclasses will have complex operations rather than simply copying * the properties to the instance. * Warning: This is implemented as needed and currently only covers "autoplay", * "playWhenInView", and "videoId" on Brightcove players. * * This is currently only used in github.com/lonelyplanet/marketing.git * at app/pages/best_in_travel/components/video_gallery.js */ }, { key: "set", value: function set(options) { Object.assign(this, options); } /** * Run any setup to load the player (ex. videojs player). * Make sure this.trigger("ready") is called within this function. */ }, { key: "setup", value: function setup() { this.trigger("ready"); } /** * Kills the underlying player (removing it from the page and any references to it) * Make sure this.trigger("disposed") is called within this function. */ }, { key: "dispose", value: function dispose() { this.trigger("disposed", this); } /** * Plays the underlying player */ }, { key: "play", value: function play() {} /** * Similar to play(), but should be used when expecting to play through a series of videos. */ }, { key: "start", value: function start() { this.play(); } /** * Pauses the underlying player */ }, { key: "pause", value: function pause() {} /** * Loads one or more videos into the players "video cache". (Currently only works with Brightcove) */ }, { key: "fetchVideos", value: function fetchVideos() {} }]); return VideoPlayer; }(_bane.Component); exports.default = VideoPlayer;