Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / node_modules / video.js / es5 / error-display.js
1 'use strict';
2
3 exports.__esModule = true;
4
5 var _component = require('./component');
6
7 var _component2 = _interopRequireDefault(_component);
8
9 var _modalDialog = require('./modal-dialog');
10
11 var _modalDialog2 = _interopRequireDefault(_modalDialog);
12
13 var _mergeOptions = require('./utils/merge-options');
14
15 var _mergeOptions2 = _interopRequireDefault(_mergeOptions);
16
17 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
18
19 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
21 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; }
22
23 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; } /**
24                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * @file error-display.js
25                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
26
27
28 /**
29  * A display that indicates an error has occurred. This means that the video
30  * is unplayable.
31  *
32  * @extends ModalDialog
33  */
34 var ErrorDisplay = function (_ModalDialog) {
35   _inherits(ErrorDisplay, _ModalDialog);
36
37   /**
38    * Creates an instance of this class.
39    *
40    * @param  {Player} player
41    *         The `Player` that this class should be attached to.
42    *
43    * @param  {Object} [options]
44    *         The key/value store of player options.
45    */
46   function ErrorDisplay(player, options) {
47     _classCallCheck(this, ErrorDisplay);
48
49     var _this = _possibleConstructorReturn(this, _ModalDialog.call(this, player, options));
50
51     _this.on(player, 'error', _this.open);
52     return _this;
53   }
54
55   /**
56    * Builds the default DOM `className`.
57    *
58    * @return {string}
59    *         The DOM `className` for this object.
60    *
61    * @deprecated Since version 5.
62    */
63
64
65   ErrorDisplay.prototype.buildCSSClass = function buildCSSClass() {
66     return 'vjs-error-display ' + _ModalDialog.prototype.buildCSSClass.call(this);
67   };
68
69   /**
70    * Gets the localized error message based on the `Player`s error.
71    *
72    * @return {string}
73    *         The `Player`s error message localized or an empty string.
74    */
75
76
77   ErrorDisplay.prototype.content = function content() {
78     var error = this.player().error();
79
80     return error ? this.localize(error.message) : '';
81   };
82
83   return ErrorDisplay;
84 }(_modalDialog2['default']);
85
86 /**
87  * The default options for an `ErrorDisplay`.
88  *
89  * @private
90  */
91
92
93 ErrorDisplay.prototype.options_ = (0, _mergeOptions2['default'])(_modalDialog2['default'].prototype.options_, {
94   pauseOnOpen: false,
95   fillAlways: true,
96   temporary: false,
97   uncloseable: true
98 });
99
100 _component2['default'].registerComponent('ErrorDisplay', ErrorDisplay);
101 exports['default'] = ErrorDisplay;