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IACnC,KAAK,WAAW,EAAU,KAAK,aAAc,KAAK,aAAe,KAAK,cAAe,KAAK,cAC9F,CACJ,EAEA,EAAS,UAAU,cAAgB,SAAuB,GACtD,KAAK,aAAa,aAAa,EACnC,EAEA,EAAS,UAAU,kBAAoB,WAEnC,OAA6D,GAArD,KAAK,MAAM,YAAc,KAAK,gBAAkB,EAC5D,EAEA,EAAS,UAAU,gBAAkB,WACjC,OAAO,KAAK,kBAAkB,OAAM,SAAU,GAC1C,QAAS,CACb,GACJ,EAEA,EAAS,UAAU,uBAAyB,SAAgC,GAExE,OADA,QAAQ,IAAI,KAAK,MAAM,YAAa,KAAK,gBAAiB,KAAK,gBAAkB,EAAiB,IAC3F,KAAK,MAAM,YAAc,KAAK,gBAAkB,EAAiB,KAAQ,KAAK,kBAAkB,EAC3G,EAaA,EAAS,UAAU,iBAAmB,SAA0B,GAE5D,GAAI,EAAQ,kBACR,OAAO,EAAQ,UAAU,QAAO,SAAU,GACtC,OAAO,EAAE,MAAQ,EAAQ,iBAC7B,GAER,EAQA,EAAS,UAAU,QAAU,WACzB,EAAQ,UAAU,QAAQ,KAAK,KACnC,EAQA,EAAS,UAAU,YAAc,WAC7B,KAAK,SAAS,CAAE,SAAU,KAAK,OAAO,UAC1C,EAUA,EAAS,UAAU,SAAW,SAAkB,GAC5C,QAAQ,IAAI,sBAAwB,KAAK,MAAM,QAAU,UAAY,UACzE,EAEO,CACX,CA3Se,CA2Sb,QAEF,SAAS,aAAe,CACpB,YAAa,kBAIjB,eAAe,WAAY,UAG3B,SAAS,QAAU,QAEnB,OAAO,QAAU","file":"/npm/@youon/videojs-settings@1.0.23/dist/videojs-settings.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@youon/videojs-settings@1.0.23/dist/videojs-settings.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar videojs = _interopDefault(require('video.js'));\nvar document = _interopDefault(require('global/document'));\nvar window = _interopDefault(require('global/window'));\n\nvar version = \"1.0.23\";\n\nvar classCallCheck = function (instance, Constructor) {\n  if (!(instance instanceof Constructor)) {\n    throw new TypeError(\"Cannot call a class as a function\");\n  }\n};\n\n\n\n\n\n\n\n\n\nvar _extends = Object.assign || function (target) {\n  for (var i = 1; i < arguments.length; i++) {\n    var source = arguments[i];\n\n    for (var key in source) {\n      if (Object.prototype.hasOwnProperty.call(source, key)) {\n        target[key] = source[key];\n      }\n    }\n  }\n\n  return target;\n};\n\n\n\nvar inherits = function (subClass, superClass) {\n  if (typeof superClass !== \"function\" && superClass !== null) {\n    throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n  }\n\n  subClass.prototype = Object.create(superClass && superClass.prototype, {\n    constructor: {\n      value: subClass,\n      enumerable: false,\n      writable: true,\n      configurable: true\n    }\n  });\n  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\n\n\n\n\n\n\n\n\n\n\nvar possibleConstructorReturn = function (self, call) {\n  if (!self) {\n    throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n  }\n\n  return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar Component$1 = videojs.getComponent('Component');\nvar MenuItem = videojs.getComponent('MenuItem');\n\n/**\r\n * The specific menu item type for selecting a language within a text track kind\r\n *\r\n * @extends MenuItem\r\n */\n\nvar QualityMenuItem = function (_MenuItem) {\n    inherits(QualityMenuItem, _MenuItem);\n\n    /**\r\n    * Creates an instance of this class.\r\n    *\r\n    * @param {Player} player\r\n    *        The `Player` that this class should be attached to.\r\n    *\r\n    * @param {Object} [options]\r\n    *        The key/value store of player options.\r\n    */\n    function QualityMenuItem(player, options) {\n        classCallCheck(this, QualityMenuItem);\n\n\n        var src = options.src;\n        var type = options.type;\n        var label = options.label;\n        var res = options.res;\n\n        // Modify options for parent MenuItem class's init.\n        // options.selected = rate === 1;\n        options.selectable = true;\n\n        var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options));\n\n        _this.src = src;\n        _this.type = type;\n        _this.label = label;\n        _this.res = res;\n\n        _this.oldCurrentTime_ = 0;\n\n        // this.on(player, 'ratechange', this.update);\n        _this.on(player, 'resolutionchange', _this.update);\n\n        // Select the item\n        _this.selected(player.src() === src);\n        return _this;\n    }\n\n    /**\r\n     * Create this element\r\n     *\r\n     * @param {Object} type\r\n     *        The `Player` that this class should be attached to.\r\n     *\r\n     * @param {Object} props\r\n     *        The `Player` that this class should be attached to.\r\n     *\r\n     * @param {Object} attrs\r\n     *        The `Player` that this class should be attached to.\r\n     *\r\n     * @return {Element}\r\n     *         The element that gets created.\r\n     */\n\n\n    QualityMenuItem.prototype.createEl = function createEl(type, props, attrs) {\n\n        var quality = this.options_;\n\n        // The control is textual, not just an icon\n        this.nonIconControl = false;\n\n        // vjs-selected\n        return _MenuItem.prototype.createEl.call(this, 'li', _extends({\n            className: 'vjs-menu-item vjs-menu-item-quality',\n            innerHTML: '<span class=\\'vjs-menu-item-text\\'>' + quality.label + '</span>',\n            tabIndex: -1\n        }, props), attrs);\n    };\n\n    /**\r\n    * This gets called when a `BigPlayButton` \"clicked\". See {@link ClickableComponent}\r\n    * for more detailed information on what a click can be.\r\n    *\r\n    * @param {EventTarget~Event} event\r\n    *        The `keydown`, `tap`, or `click` event that caused this function to be\r\n    *        called.\r\n    *\r\n    * @listens tap\r\n    * @listens click\r\n    */\n\n\n    QualityMenuItem.prototype.handleClick = function handleClick(event) {\n\n        _MenuItem.prototype.handleClick.call(this);\n        // console.log(this.player());\n        this.player().trigger('resolutionchange', this.res);\n        // this.player().playbackRate(this.rate);\n    };\n\n    /**\r\n    * update function\r\n    *\r\n    * @param {EventTarget~Event} event\r\n    *        The `keydown`, `tap`, or `click` event that caused this function to be\r\n    *        called.\r\n    *\r\n    * @param {int} res\r\n    *        The resolution number.\r\n    */\n\n\n    QualityMenuItem.prototype.update = function update(event, res) {\n        var _this2 = this;\n\n        // console.log(event);\n        // this.selected(this.player().playbackRate() === this.rate);\n        // this.oldCurrentTime_ = this.player().currentTime();\n\n        var currentSrc = this.player().currentSrc();\n        var changedQuality = currentSrc !== this.options_.src;\n\n        /*eslint-disable */\n        if (res === this.res && changedQuality) {\n            var oldCurrentTime_ = this.player().currentTime();\n            // const req = new XMLHttpRequest();  // eslint-disable-line\n            // req.open('GET', this.options_.src, true);\n            // req.responseType = 'arraybuffer';\n            //\n            // req.onload = function(ev) {\n            //   // create a new media source to hold the data buffers\n            //   const mediaSource = new videojs.MediaSource({ mode: 'html5' });\n            //\n            //   // wrap the arraybuffer in a view so we can easily work with the\n            //   // individual bytes\n            //   const bytes = new Uint8Array(req.response);\n            //\n            //   // when a media source is assigned to a video element the `sourceopen`\n            //   // event fires\n            //   mediaSource.addEventListener('sourceopen', function(e) {\n            //\n            //     // Set the duration of the media source\n            //     mediaSource.duration = this.options_.duration;\n            //\n            //     const mimeCodec = 'video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"';\n            //     // construct the video data buffer and set the appropriate MIME type\n            //     const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);\n            //\n            //     // start feeding bytes to the buffer\n            //     // the video element that is reading from the associated media buffer is\n            //     // ready to start playing now\n            //     sourceBuffer.appendBuffer(bytes, this.player().tech().el_);\n            //\n            //     sourceBuffer.addEventListener('updateend', function(_) {\n            //       mediaSource.endOfStream();\n            //     });\n            //\n            //   }.bind(this), false);\n            //\n            //   // to assign a media source to a video element, you have to create a URL for it\n            //   const url = videojs.URL.createObjectURL(mediaSource);\n            //\n            //   // assign the media source URL to video.js\n            //   /*\n            //   this.player().src({\n            //     src: url,\n            //     type: 'video/mp4'\n            //   });\n            //   */\n            //   this.player().tech().el_.src = url;\n            //\n            //   this.player().play();\n            //   this.player().on(this.player(), 'loadedmetadata', () => {\n            //\n            //     this.player().currentTime(oldCurrentTime_);\n            //\n            //   });\n            //\n            // }.bind(this);\n            // req.send(null);\n\n            /*eslint-enable */\n            // console.log(oldCurrentTime_);\n            this.player().src({\n                src: this.options_.src,\n                type: 'video/mp4'\n            });\n\n            this.player().play();\n            this.player().on(this.player(), 'loadedmetadata', function () {\n\n                _this2.player().currentTime(oldCurrentTime_);\n            });\n        }\n\n        this.selected(res === this.res);\n    };\n\n    return QualityMenuItem;\n}(MenuItem);\n\n/**\r\n * The text that should display over the `BigPlayButton`s controls.\r\n * Added to for localization.\r\n *\r\n * @type {string}\r\n * @private\r\n */\n\n\nQualityMenuItem.prototype.controlText_ = 'Settings Menu Item';\n\nComponent$1.registerComponent('QualityMenuItem', QualityMenuItem);\n\nvar Component$2 = videojs.getComponent('Component');\nvar MenuItem$1 = videojs.getComponent('MenuItem');\n\n/**\r\n * The specific menu item type for selecting a language within a text track kind\r\n *\r\n * @extends MenuItem\r\n */\n\nvar QualityMenuHeader = function (_MenuItem) {\n  inherits(QualityMenuHeader, _MenuItem);\n\n  /**\r\n  * Creates an instance of this class.\r\n  *\r\n  * @param {Player} player\r\n  *        The `Player` that this class should be attached to.\r\n  *\r\n  * @param {Object} [options]\r\n  *        The key/value store of player options.\r\n  */\n  function QualityMenuHeader(player, options) {\n    classCallCheck(this, QualityMenuHeader);\n    return possibleConstructorReturn(this, _MenuItem.call(this, player, options));\n  }\n\n  /**\r\n   * Create this element\r\n   *\r\n   * @param {Object} type\r\n   *        The `Player` that this class should be attached to.\r\n   *\r\n   * @param {Object} props\r\n   *        The `Player` that this class should be attached to.\r\n   *\r\n   * @param {Object} attrs\r\n   *        The `Player` that this class should be attached to.\r\n   *\r\n   * @return {Element}\r\n   *         The element that gets created.\r\n   */\n\n\n  QualityMenuHeader.prototype.createEl = function createEl(type, props, attrs) {\n\n    // The control is textual, not just an icon\n    this.nonIconControl = false;\n\n    // vjs-selected\n    return _MenuItem.prototype.createEl.call(this, 'li', _extends({\n      className: 'vjs-menu-item-header',\n      innerHTML: '<span class=\"vjs-menu-item-text\">Quality</span>',\n      tabIndex: -1\n    }, props), attrs);\n  };\n\n  /**\r\n  * This gets called when a `BigPlayButton` \"clicked\". See {@link ClickableComponent}\r\n  * for more detailed information on what a click can be.\r\n  *\r\n  * @param {EventTarget~Event} event\r\n  *        The `keydown`, `tap`, or `click` event that caused this function to be\r\n  *        called.\r\n  *\r\n  * @listens tap\r\n  * @listens click\r\n  */\n\n\n  QualityMenuHeader.prototype.handleClick = function handleClick(event) {\n    return false;\n  };\n\n  return QualityMenuHeader;\n}(MenuItem$1);\n\n/**\r\n * The text that should display over the `BigPlayButton`s controls.\r\n * Added to for localization.\r\n *\r\n * @type {string}\r\n * @private\r\n */\n\n\nQualityMenuHeader.prototype.controlText_ = '';\n\nComponent$2.registerComponent('QualityMenuHeader', QualityMenuHeader);\n\nvar MenuButton = videojs.getComponent('MenuButton');\n// const Button = videojs.getComponent('Button');\n\n/**\r\n * The initial play button that shows before the video has played. The hiding of the\r\n * `BigPlayButton` get done via CSS and `Player` states.\r\n *\r\n * @extends Button\r\n */\n\nvar SettingsMenu = function (_MenuButton) {\n  inherits(SettingsMenu, _MenuButton);\n\n  /**\r\n  * Creates an instance of this class.\r\n  *\r\n  * @param {Player} player\r\n  *        The `Player` that this class should be attached to.\r\n  *\r\n  * @param {Object} [options]\r\n  *        The key/value store of player options.\r\n  */\n  function SettingsMenu(player, options) {\n    classCallCheck(this, SettingsMenu);\n\n    var _this = possibleConstructorReturn(this, _MenuButton.call(this, player, options));\n\n    _this.options_ = options;\n    // this.resolutions_ = this.player().options_.resolutions;\n    // this.resolutions_ = options.qualities;\n\n    return _this;\n  }\n\n  /**\r\n  * Get possible qualities rates\r\n  *\r\n  * @return {Array}\r\n  *         All possible playback rates\r\n  */\n\n\n  SettingsMenu.prototype.qualities = function qualities() {\n    return this.options_.qualities || [];\n  };\n\n  /**\r\n  * Create the list of menu items. Specific to each subclass.\r\n  *\r\n  * @return {Array}\r\n  *         All possible playback rates\r\n  */\n\n\n  SettingsMenu.prototype.createItems = function createItems() {\n    var _this2 = this;\n\n    var qualities = this.qualities();\n\n    if (Array.isArray(qualities)) {\n      var qts = qualities.map(function (quality) {\n        return new QualityMenuItem(_this2.player(), quality);\n      });\n\n      qts.unshift(new QualityMenuHeader(this.player(), { selectable: false }));\n      return qts;\n    }\n\n    return [];\n  };\n\n  /**\r\n  * createEl function\r\n  *\r\n  * @return {Element}\r\n  *         The element that gets created.\r\n  */\n\n\n  SettingsMenu.prototype.createEl = function createEl() {\n\n    return _MenuButton.prototype.createEl.call(this);\n  };\n\n  /**\r\n  * Builds the default DOM `className`.\r\n  *\r\n  * @return {string}\r\n  *         The DOM `className` for this object.\r\n  */\n\n\n  SettingsMenu.prototype.buildCSSClass = function buildCSSClass() {\n    return 'vjs-settings ' + _MenuButton.prototype.buildCSSClass.call(this);\n  };\n\n  /**\r\n   * Builds wrapper css class\r\n   *\r\n   * @return {string}\r\n   *         The DOM `className` for this object.\r\n   */\n\n\n  SettingsMenu.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() {\n    return 'vjs-settings ' + _MenuButton.prototype.buildWrapperCSSClass.call(this);\n  };\n\n  return SettingsMenu;\n}(MenuButton);\n\n/**\r\n * The text that should display over the `BigPlayButton`s controls.\r\n * Added to for localization.\r\n *\r\n * @type {string}\r\n * @private\r\n */\n\n\nSettingsMenu.prototype.controlText_ = 'Settings Menu';\n\n/**\r\n * @file stylesheet.js\r\n * @module stylesheet\r\n */\n/**\r\n * Create a DOM syle element given a className for it.\r\n *\r\n * @param {string} className\r\n *        The className to add to the created style element.\r\n *\r\n * @return {Element}\r\n *         The element that was created.\r\n */\nvar createStyleElement = function createStyleElement(className) {\n  var style = document.createElement('style');\n\n  style.className = className;\n\n  return style;\n};\n\n/**\r\n * Add text to a DOM element.\r\n *\r\n * @param {Element} el\r\n *        The Element to add text content to.\r\n *\r\n * @param {string} content\r\n *        The text to add to the element.\r\n */\nvar setTextContent = function setTextContent(el, content) {\n  if (el.styleSheet) {\n    el.styleSheet.cssText = content;\n  } else {\n    el.textContent = content;\n  }\n};\n\n/**\r\n * @file computed-style.js\r\n * @module computed-style\r\n */\n/**\r\n * A safe getComputedStyle.\r\n *\r\n * This is needed because in Firefox, if the player is loaded in an iframe with\r\n * `display:none`, then `getComputedStyle` returns `null`, so, we do a null-check to\r\n * make sure  that the player doesn't break in these cases.\r\n *\r\n * @param {Element} el\r\n *        The element you want the computed style of\r\n *\r\n * @param {string} prop\r\n *        The property name you want\r\n *\r\n * @return {string}\r\n *        The computed style\r\n *\r\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\r\n *\r\n * @static\r\n * @const\r\n */\nfunction computedStyle(el, prop) {\n  if (!el || !prop) {\n    return '';\n  }\n\n  if (typeof window.getComputedStyle === 'function') {\n    var cs = window.getComputedStyle(el);\n\n    return cs ? cs[prop] : '';\n  }\n\n  return '';\n}\n\nvar dom = videojs.dom || videojs;\n\nvar style = (function (player) {\n\n  var styleEl_ = createStyleElement('vjs-styles-hover');\n  var defaultsStyleEl = dom.$('.vjs-styles-defaults');\n  var head = dom.$('head');\n\n  head.insertBefore(styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);\n\n  var hover = computedStyle(dom.$('.vjs-play-progress.vjs-slider-bar', player.el()), 'background-color');\n  // let idClass = player.id();\n\n  setTextContent(styleEl_, '\\n        \\n        .vjs-menu li.vjs-menu-item:hover {\\n          background-color: ' + hover + ' !important;\\n          color: #FFF;\\n        }\\n                              \\n        .vjs-settings .vjs-menu li.vjs-selected {\\n         font-weight: 700;\\n         color: #FFF;\\n         background-color: ' + hover + ';\\n        }\\n        \\n        .vjs-settings .vjs-menu li.vjs-selected:hover {\\n          color: #FFF;\\n          background: none;\\n        }\\n  ');\n});\n\n// Default options for the plugin.\n// const defaults = {};\n\n// Cross-compatibility for Video.js 5 and 6.\nvar registerPlugin = videojs.registerPlugin || videojs.plugin;\n// const dom = videojs.dom || videojs;\n\nvar Plugin = videojs.getPlugin('plugin');\nvar Component = videojs.getComponent('Component');\n\n/**\n * Settings plugin\n *\n * @extends Plugin\n */\n\nvar Settings = function (_Plugin) {\n    inherits(Settings, _Plugin);\n\n    /**\n    * Creates an instance of this class.\n    *\n    * @param {Player} player\n    *        The `Player` that this class should be attached to.\n    *\n    * @param {Object} [options]\n    *        The key/value store of player options.\n    */\n    function Settings(player, options) {\n        classCallCheck(this, Settings);\n\n        var _this = possibleConstructorReturn(this, _Plugin.call(this, player, options));\n\n        player.ready(function () {\n\n            /*eslint-disable */\n            // TODO Class to be removed\n            player.addClass('vjs-settings');\n\n            _this.video = _this.player.tech().el_;\n\n            /*eslint-enable */\n            _this.initialQuality = _this.getInitalQuality(options).shift();\n\n            // Media Source Extensions\n            // videojs.getAllPlayers()[0].tech().el_\n\n            // Set the initial source\n            if (_this.initialQuality) {\n\n                player.src({\n                    src: _this.initialQuality.src,\n                    type: 'video/mp4'\n                });\n\n                /*eslint-disable */\n\n                // // Need to be specific for Blink regarding codecs\n                // this.mimeCodec = 'video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"';\n                //\n                // this.totalSegments = 5;\n                // this.segmentLength = 0;\n                // this.segmentDuration = 0;\n                // this.bytesFetched = 0;\n                // this.requestedSegments = [];\n                //\n                // for (var i = 0; i < this.totalSegments; ++i) this.requestedSegments[i] = false;\n                //\n                // this.mediaSource = null;\n                // this.sourceBuffer = null;\n                //\n                // if ('MediaSource' in window && MediaSource.isTypeSupported(this.mimeCodec)) {\n                //\n                //     // Create a new MediaSource\n                //     //var mediaSource = new videojs.MediaSource({ mode: 'html5' });\n                //     this.mediaSource = new MediaSource();\n                //\n                //     // Attach the MediaSource to the video\n                //     this.player.tech().el_.src = window.URL.createObjectURL(this.mediaSource);\n                //\n                //     this.mediaSource.addEventListener('sourceopen', this.sourceOpen.bind(this));\n                //\n                // } else {\n                //     console.error('Unsupported MIME type or codec: ', this.mimeCodec);\n                // }\n                //\n                //   /*eslint-enable */\n                //\n                //\n                //   const req = new XMLHttpRequest();  // eslint-disable-line\n                //     /*req.open('GET', initialQuality.src, true);\n                //     req.responseType = 'arraybuffer';\n                //     */\n                //   req.onload = function(event) {\n                //\n                //     // create a new media source to hold the data buffers\n                //     const mediaSource = new videojs.MediaSource({ mode: 'html5' });\n                //\n                //     // wrap the arraybuffer in a view so we can easily work with the\n                //     // individual bytes\n                //     const bytes = new Uint8Array(req.response);\n                //\n                //     // when a media source is assigned to a video element the `sourceopen`\n                //     // event fires\n                //     mediaSource.addEventListener('sourceopen', function(e) {\n                //\n                //       // Set the duration of the media source\n                //       mediaSource.duration = initialQuality.duration;\n                //\n                //       const mimeCodec = 'video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"';\n                //       // construct the video data buffer and set the appropriate MIME type\n                //       const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);\n                //\n                //       // start feeding bytes to the buffer\n                //       // the video element that is reading from the associated media buffer is\n                //       // ready to start playing now\n                //       sourceBuffer.appendBuffer(bytes, this.player.tech().el_);\n                //\n                //       sourceBuffer.addEventListener('updateend', function(_) {\n                //         mediaSource.endOfStream();\n                //       });\n                //\n                //     }.bind(this), false);\n                //\n                //     // to assign a media source to a video element, you have to create a URL for it\n                //     const url = videojs.URL.createObjectURL(mediaSource);\n                //\n                //     // assign the media source URL to video.js\n                //     /*\n                //     player.src({\n                //       src: url,\n                //       type: 'video/mp4'\n                //     });\n                //     */\n                //     this.player.tech().el_.src = url;\n                //\n                //   }.bind(this);\n                //   //req.send(null);\n            }\n\n            // Register the SettingsMenu Component\n            Component.registerComponent('SettingsMenu', SettingsMenu);\n\n            var controlBar = player.getChild('controlBar');\n            var index = controlBar.children().length - 1;\n\n            // Add the SettingsMenu component to the controlBar Component at position index\n            controlBar.addChild('SettingsMenu', options, index);\n\n            // Apply the stylesheets for hover effects\n            style(player);\n        });\n\n        _this.on('statechanged', _this.logState);\n        return _this;\n    }\n\n    Settings.prototype.sourceOpen = function sourceOpen() {\n        var _this2 = this;\n\n        console.log(this.mediaSource.readyState); // open\n\n        // Create a SourceBuffer\n        this.sourceBuffer = this.mediaSource.addSourceBuffer(this.mimeCodec);\n\n        // Set the duration of the media source\n        //this.mediaSource.duration = this.initialQuality.duration;\n\n        fetch(this.initialQuality.src, {\n            method: 'HEAD',\n            headers: {}\n        }).then(function (response) {\n            return response.headers.get('content-length');\n            // Inspect the headers in the response\n\n            // response.headers.forEach(console.log);\n\n            // OR you can do this\n            /*for(let entry of response.headers.entries()) {\n                console.log(entry);\n            }*/\n        }).then(function (fileLength) {\n\n            var video = _this2.player.tech().el_;\n            _this2.segmentLength = Math.round(fileLength / _this2.totalSegments);\n\n            _this2.fetchRange(_this2.initialQuality.src, 0, _this2.segmentLength, _this2.appendSegment.bind(_this2));\n            _this2.requestedSegments[0] = true;\n            video.addEventListener('timeupdate', _this2.checkBuffer.bind(_this2));\n            video.addEventListener('canplay', function () {\n                console.log(video.duration, _this2.totalSegments);\n                _this2.segmentDuration = video.duration / _this2.totalSegments;\n                video.play();\n            });\n            //this.video.addEventListener('seeking', this.seek);\n\n            /*// Initial segment\n            let start = 0;\n            let end = this.segmentLength;\n            // fetch range\n            fetch(this.initialQuality.src,{\n                headers:{\n                    'Range': 'bytes=' + start + '-' + end\n                }\n            })\n            .then((response) => {\n                return response.arrayBuffer();\n            })\n            .then((arrayBuffer) => {\n                this.sourceBuffer.appendBuffer(arrayBuffer);\n            });*/\n        });\n    };\n\n    Settings.prototype.fetchRange = function fetchRange(url, start, end, cb) {\n        var xhr = new XMLHttpRequest();\n        xhr.open('get', url);\n        xhr.responseType = 'arraybuffer';\n        xhr.setRequestHeader('Range', 'bytes=' + start + '-' + end);\n        xhr.onload = function () {\n            console.log('fetched bytes: ', start, end);\n            this.bytesFetched += end - start + 1;\n            cb(xhr.response);\n        };\n        xhr.send();\n    };\n\n    Settings.prototype.checkBuffer = function checkBuffer(_) {\n        var video = this.player.tech().el_;\n        var currentSegment = this.getCurrentSegment();\n        if (currentSegment === this.totalSegments && this.haveAllSegments()) {\n            console.log('last segment', this.mediaSource.readyState);\n            this.mediaSource.endOfStream();\n            video.removeEventListener('timeupdate', this.checkBuffer);\n        } else if (this.shouldFetchNextSegment(currentSegment)) {\n            this.requestedSegments[currentSegment] = true;\n            console.log('time to fetch next chunk', video.currentTime);\n            var assetURL = this.initialQuality.src;\n            this.fetchRange(assetURL, this.bytesFetched, this.bytesFetched + this.segmentLength, this.appendSegment);\n        }\n    };\n\n    Settings.prototype.appendSegment = function appendSegment(chunk) {\n        this.sourceBuffer.appendBuffer(chunk);\n    };\n\n    Settings.prototype.getCurrentSegment = function getCurrentSegment() {\n        // console.log(this.video.currentTime, this.segmentDuration);\n        return (this.video.currentTime / this.segmentDuration | 0) + 1;\n    };\n\n    Settings.prototype.haveAllSegments = function haveAllSegments() {\n        return this.requestedSegments.every(function (val) {\n            return !!val;\n        });\n    };\n\n    Settings.prototype.shouldFetchNextSegment = function shouldFetchNextSegment(currentSegment) {\n        console.log(this.video.currentTime, this.segmentDuration, this.segmentDuration * currentSegment * 0.8);\n        return this.video.currentTime > this.segmentDuration * currentSegment * 0.8 && !this.requestedSegments[currentSegment];\n    };\n\n    /**\n     * Get the initial quality options\n     *\n     * @param {Object} [options]\n     *        The key/value store of player options.\n     *\n     * @return {Array}\n     *        All initial resolutions\n     */\n\n\n    Settings.prototype.getInitalQuality = function getInitalQuality(options) {\n\n        if (options.defaultResolution) {\n            return options.qualities.filter(function (q) {\n                return q.res === options.defaultResolution;\n            });\n        }\n    };\n\n    /**\n    * dispose\n    *\n    */\n\n\n    Settings.prototype.dispose = function dispose() {\n        _Plugin.prototype.dispose.call(this);\n    };\n\n    /**\n     * updateState\n     *\n     */\n\n\n    Settings.prototype.updateState = function updateState() {\n        this.setState({ playing: !this.player.paused() });\n    };\n\n    /**\n     * logState\n     *\n     * @param {string} changed\n     *        A state\n     */\n\n\n    Settings.prototype.logState = function logState(changed) {\n        videojs.log('the player is now ' + (this.state.playing ? 'playing' : 'paused'));\n    };\n\n    return Settings;\n}(Plugin);\n\nSettings.defaultState = {\n    customClass: 'default-custom'\n};\n\n// Register the plugin with video.js.\nregisterPlugin('settings', Settings);\n\n// Include the version number.\nSettings.VERSION = version;\n\nmodule.exports = Settings;\n"]}