3 exports.__esModule = true;
5 var _trackList = require('./track-list');
7 var _trackList2 = _interopRequireDefault(_trackList);
9 var _fn = require('../utils/fn.js');
11 var Fn = _interopRequireWildcard(_fn);
13 var _browser = require('../utils/browser.js');
15 var browser = _interopRequireWildcard(_browser);
17 var _document = require('global/document');
19 var _document2 = _interopRequireDefault(_document);
21 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
23 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
25 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27 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; }
29 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; } /**
30 * @file text-track-list.js
35 * The current list of {@link TextTrack} for a media file.
37 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}
40 var TextTrackList = function (_TrackList) {
41 _inherits(TextTrackList, _TrackList);
44 * Create an instance of this class.
46 * @param {TextTrack[]} [tracks=[]]
47 * A list of `TextTrack` to instantiate the list with.
49 function TextTrackList() {
52 var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
54 _classCallCheck(this, TextTrackList);
58 // IE8 forces us to implement inheritance ourselves
59 // as it does not support Object.defineProperty properly
61 list = _document2['default'].createElement('custom');
62 for (var prop in _trackList2['default'].prototype) {
63 if (prop !== 'constructor') {
64 list[prop] = _trackList2['default'].prototype[prop];
67 for (var _prop in TextTrackList.prototype) {
68 if (_prop !== 'constructor') {
69 list[_prop] = TextTrackList.prototype[_prop];
74 list = (_this = _possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);
75 return _ret = list, _possibleConstructorReturn(_this, _ret);
79 * Add a {@link TextTrack} to the `TextTrackList`
81 * @param {TextTrack} track
82 * The text track to add to the list.
84 * @fires TrackList#addtrack
89 TextTrackList.prototype.addTrack_ = function addTrack_(track) {
90 _TrackList.prototype.addTrack_.call(this, track);
93 * @listens TextTrack#modechange
94 * @fires TrackList#change
96 track.addEventListener('modechange', Fn.bind(this, function () {
97 this.trigger('change');
101 return TextTrackList;
102 }(_trackList2['default']);
104 exports['default'] = TextTrackList;