3 exports.__esModule = true;
5 var _browser = require('../utils/browser.js');
7 var browser = _interopRequireWildcard(_browser);
9 var _document = require('global/document');
11 var _document2 = _interopRequireDefault(_document);
13 var _guid = require('../utils/guid.js');
15 var Guid = _interopRequireWildcard(_guid);
17 var _eventTarget = require('../event-target');
19 var _eventTarget2 = _interopRequireDefault(_eventTarget);
21 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
23 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; } }
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; } /**
35 * A Track class that contains all of the common functionality for {@link AudioTrack},
36 * {@link VideoTrack}, and {@link TextTrack}.
38 * > Note: This class should not be used directly
40 * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}
41 * @extends EventTarget
44 var Track = function (_EventTarget) {
45 _inherits(Track, _EventTarget);
48 * Create an instance of this class.
50 * @param {Object} [options={}]
51 * Object of option names and values
53 * @param {string} [options.kind='']
54 * A valid kind for the track type you are creating.
56 * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
57 * A unique id for this AudioTrack.
59 * @param {string} [options.label='']
60 * The menu label for this track.
62 * @param {string} [options.language='']
63 * A valid two character language code.
70 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
72 _classCallCheck(this, Track);
74 var _this = _possibleConstructorReturn(this, _EventTarget.call(this));
76 var track = _this; // eslint-disable-line
79 track = _document2['default'].createElement('custom');
80 for (var prop in Track.prototype) {
81 if (prop !== 'constructor') {
82 track[prop] = Track.prototype[prop];
88 id: options.id || 'vjs_track_' + Guid.newGUID(),
89 kind: options.kind || '',
90 label: options.label || '',
91 language: options.language || ''
96 * The id of this track. Cannot be changed after creation.
102 * @member {string} kind
103 * The kind of track that this is. Cannot be changed after creation.
109 * @member {string} label
110 * The label of this track. Cannot be changed after creation.
116 * @member {string} language
117 * The two letter language code for this track. Cannot be changed after
123 var _loop = function _loop(key) {
124 Object.defineProperty(track, key, {
125 get: function get() {
126 return trackProps[key];
128 set: function set() {}
132 for (var key in trackProps) {
136 return _ret = track, _possibleConstructorReturn(_this, _ret);
140 }(_eventTarget2['default']);
142 exports['default'] = Track;