aboutsummaryrefslogtreecommitdiff
path: root/assets/netcut/lib/videojs-markers/videojs-markers.js.map
blob: 0dbedd38539d7e733b2231e843a9012a15904fb2 (plain)
1
{"version":3,"sources":["videojs-markers.js"],"names":["defaultSetting","markerStyle","markerTip","display","text","marker","time","breakOverlay","displayTime","overlayText","style","onMarkerClick","onMarkerReached","index","markers","generateUUID","d","Date","getTime","uuid","replace","c","r","Math","random","floor","toString","getElementBounding","element","elementBounding","defaultBoundingRect","top","bottom","left","width","height","right","getBoundingClientRect","e","NULL_INDEX","registerVideoJsMarkersPlugin","options","mergeOptions","isPlain","value","call","constructor","Object","source1","source2","result","sources","forEach","source","keys","key","dom","createEl","tagName","props","attrs","el","Player","prototype","setAttribute","setting","markersMap","markersList","currentMarkerIndex","player","overlayIndex","sortMarkersList","sort","a","b","addMarkers","newMarkers","querySelector","appendChild","createMarkerDiv","push","getPosition","duration","setMarkderDivStyle","markerDiv","className","class","ratio","marginLeft","markerDivBounding","addEventListener","preventDefault","getAttribute","currentTime","registerMarkerTipHandler","updateMarkers","force","markerTime","removeMarkers","indexArray","visibility","deleteIndexList","parentNode","removeChild","reverse","deleteIndex","splice","innerText","markerTipBounding","parseFloat","initializeMarkerTip","innerHTML","updateBreakOverlay","initializeOverlay","onTimeUpdate","onUpdateMarker","onTimeUpdateAfterMarkerUpdate","length","getNextMarkerTime","newMarkerIndex","nextMarkerTime","i","initialize","removeAll","on","off","getMarkers","next","prev","add","remove","updateTime","reset","destroy","registerPlugin"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;AAcA;AACA,MAAMA,iBAAiB;AACrBC,iBAAa;AACX,eAAQ,KADG;AAEX,uBAAiB,KAFN;AAGX,0BAAoB;AAHT,KADQ;AAMrBC,eAAW;AACTC,eAAS,IADA;AAETC,YAAM,cAASC,MAAT,EAAiB;AACrB,eAAO,YAAYA,OAAOD,IAA1B;AACD,OAJQ;AAKTE,YAAM,cAASD,MAAT,EAAiB;AACrB,eAAO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AItD,YAAYkD,MAAhC,EAAwCI,GAAxC,EAA6C;AAC3CtB,qBAAWnB,IAAX,CAAgByC,CAAhB;AACD;AACDvB,sBAAcC,UAAd;AACD,OAzCc;AA0Cf;AACAgC,kBAAY,oBAASnC,KAAT,EAA+B;AACzC;AACAD,sBAAcC,KAAd;AACD,OA9Cc;AA+CfoC,aAAO,eAASxD,UAAT,EAA0C;AAC/C;AACAP,eAAOvD,OAAP,CAAe6G,SAAf;AACAhD,mBAAWC,UAAX;AACD,OAnDc;AAoDfyD,eAAS,mBAAiB;AACxB;AACAhE,eAAOvD,OAAP,CAAe6G,SAAf;AACApH,wBAAgBA,aAAa2H,MAAb,EAAhB;AACAhI,qBAAaA,UAAUgI,MAAV,EAAb;AACA7D,eAAOwD,GAAP,CAAW,YAAX,EAAyBb,kBAAzB;AACA,eAAO3C,OAAOvD,OAAd;AACD;AA3Dc,KAAjB;AA6DD;;AAED,kBAAQwH,cAAR,CAAuB,SAAvB,EAAkC9F,4BAAlC","file":"videojs-markers.js","sourcesContent":["/*! videojs-markers - v1.0.1 - 2018-04-03\n* Copyright (c) 2018 ; Licensed  */\n'use strict';\n\nimport videojs from 'video.js';\n\ntype Marker = {\n  time: number,\n  duration: number,\n  text?: string,\n  class?: string,\n  overlayText?: string,\n  // private property\n  key: string,\n};\n\n// default setting\nconst defaultSetting = {\n  markerStyle: {\n    'width':'7px',\n    'border-radius': '30%',\n    'background-color': 'red',\n  },\n  markerTip: {\n    display: true,\n    text: function(marker) {\n      return \"Break: \" + marker.text;\n    },\n    time: function(marker) {\n      return marker.time;\n    },\n  },\n  breakOverlay:{\n    display: false,\n    displayTime: 3,\n    text: function(marker) {\n      return \"Break overlay: \" + marker.overlayText;\n    },\n    style: {\n      'width':'100%',\n      'height': '20%',\n      'background-color': 'rgba(0,0,0,0.7)',\n      'color': 'white',\n      'font-size': '17px',\n    },\n  },\n  onMarkerClick: function(marker) {},\n  onMarkerReached: function(marker, index) {},\n  markers: [],\n};\n\n// create a non-colliding random number\nfunction generateUUID(): string {\n  var d = new Date().getTime();\n  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n    var r = (d + Math.random()*16)%16 | 0;\n    d = Math.floor(d/16);\n    return (c=='x' ? r : (r&0x3|0x8)).toString(16);\n  });\n  return uuid;\n};\n\n/**\n * Returns the size of an element and its position\n * a default Object with 0 on each of its properties\n * its return in case there's an error\n * @param  {Element} element  el to get the size and position\n * @return {DOMRect|Object}   size and position of an element\n */\nfunction getElementBounding(element) {\n  var elementBounding;\n  const defaultBoundingRect = {\n    top: 0,\n    bottom: 0,\n    left: 0,\n    width: 0,\n    height: 0,\n    right: 0\n  };\n\n  try {\n    elementBounding = element.getBoundingClientRect();\n  } catch (e) {\n    elementBounding = defaultBoundingRect;\n  }\n\n  return elementBounding;\n}\n\nconst NULL_INDEX = -1;\n\nfunction registerVideoJsMarkersPlugin(options) {\n  // copied from video.js/src/js/utils/merge-options.js since\n  // videojs 4 doens't support it by defualt.\n  if (!videojs.mergeOptions) {\n    function isPlain(value) {\n      return !!value && typeof value === 'object' &&\n        toString.call(value) === '[object Object]' &&\n        value.constructor === Object;\n    }\n    function mergeOptions(source1: Object, source2: Object) {\n\n      const result = {};\n      const sources = [source1, source2];\n      sources.forEach(source => {\n        if (!source) {\n          return;\n        }\n        Object.keys(source).forEach(key => {\n          let value = source[key];\n          if (!isPlain(value)) {\n            result[key] = value;\n            return;\n          }\n          if (!isPlain(result[key])) {\n            result[key] = {};\n          }\n          result[key] = mergeOptions(result[key], value);\n        })\n      });\n      return result;\n    }\n    videojs.mergeOptions = mergeOptions;\n  }\n\n  if (!videojs.dom.createEl) {\n    videojs.dom.createEl = function(tagName: string, props: Object, attrs?: Object): void {\n      const el = videojs.Player.prototype.dom.createEl(tagName, props);\n      if (!!attrs) {\n        Object.keys(attrs).forEach(key => {\n          el.setAttribute(key, attrs[key]);\n        });\n      }\n      return el;\n    }\n  }\n  \n\n  /**\n   * register the markers plugin (dependent on jquery)\n   */\n  let setting = videojs.mergeOptions(defaultSetting, options),\n      markersMap: {[key:string]: Marker} = {},\n      markersList: Array<Marker>  = [], // list of markers sorted by time\n      currentMarkerIndex  = NULL_INDEX,\n      player       = this,\n      markerTip    = null,\n      breakOverlay = null,\n      overlayIndex = NULL_INDEX;\n\n  function sortMarkersList(): void {\n    // sort the list by time in asc order\n    markersList.sort((a, b) => {\n      return setting.markerTip.time(a) - setting.markerTip.time(b);\n    });\n  }\n\n  function addMarkers(newMarkers: Array<Marker>): void {\n    newMarkers.forEach((marker: Marker) => {\n      marker.key = generateUUID();\n\n      player.el().querySelector('.vjs-progress-holder')\n        .appendChild(createMarkerDiv(marker));\n\n      // store marker in an internal hash map\n      markersMap[marker.key] = marker;\n      markersList.push(marker);\n    })\n\n    sortMarkersList();\n  }\n\n  function getPosition(marker: Marker): number {\n    return (setting.markerTip.time(marker) / player.duration()) * 100;\n  }\n\n  function setMarkderDivStyle(marker: Marker, markerDiv: Object): void {\n    markerDiv.className = `vjs-marker ${marker.class || \"\"}`;\n\n    Object.keys(setting.markerStyle).forEach(key => {\n      markerDiv.style[key] = setting.markerStyle[key];\n    });\n\n    // hide out-of-bound markers\n    const ratio = marker.time / player.duration();\n    if (ratio < 0 || ratio > 1) {\n      markerDiv.style.display = 'none';\n    }\n\n    // set position\n    markerDiv.style.left = getPosition(marker) + '%';\n    if (marker.duration) {\n      markerDiv.style.width = (marker.duration / player.duration()) * 100 + '%';\n      markerDiv.style.marginLeft = '0px';\n    } else {\n      const markerDivBounding = getElementBounding(markerDiv);\n      markerDiv.style.marginLeft = markerDivBounding.width / 2 + 'px';\n    }    \n  }\n\n  function createMarkerDiv(marker: Marker): Object {\n\n    var markerDiv = videojs.dom.createEl('div', {}, {\n      'data-marker-key': marker.key,\n      'data-marker-time': setting.markerTip.time(marker)\n    });\n\n    setMarkderDivStyle(marker, markerDiv);\n\n    // bind click event to seek to marker time\n    markerDiv.addEventListener('click', function(e) {\n      var preventDefault = false;\n      if (typeof setting.onMarkerClick === \"function\") {\n        // if return false, prevent default behavior\n        preventDefault = setting.onMarkerClick(marker) === false;\n      }\n\n      if (!preventDefault) {\n        var key = this.getAttribute('data-marker-key');\n        player.currentTime(setting.markerTip.time(markersMap[key]));\n      }\n    });\n\n    if (setting.markerTip.display) {\n      registerMarkerTipHandler(markerDiv);\n    }\n\n    return markerDiv;\n  }\n\n  function updateMarkers(force: boolean): void {\n    // update UI for markers whose time changed\n    markersList.forEach((marker: Marker) => {\n      var markerDiv = player.el().querySelector(\".vjs-marker[data-marker-key='\" + marker.key +\"']\");\n      var markerTime = setting.markerTip.time(marker);\n\n      if (force || markerDiv.getAttribute('data-marker-time') !== markerTime) {\n        setMarkderDivStyle(marker, markerDiv);\n        markerDiv.setAttribute('data-marker-time', markerTime);\n      }\n    });\n    sortMarkersList();\n  }\n\n  function removeMarkers(indexArray: Array<number>): void {\n    // reset overlay\n    if (!!breakOverlay){\n      overlayIndex = NULL_INDEX;\n      breakOverlay.style.visibility = \"hidden\";\n    }\n    currentMarkerIndex = NULL_INDEX;\n\n    let deleteIndexList: Array<number> = [];\n    indexArray.forEach((index: number) => {\n      let marker = markersList[index];\n      if (marker) {\n        // delete from memory\n        delete markersMap[marker.key];\n        deleteIndexList.push(index);\n\n        // delete from dom\n        let el = player.el().querySelector(\".vjs-marker[data-marker-key='\" + marker.key +\"']\");\n        el && el.parentNode.removeChild(el);\n      }\n    });\n\n    // clean up markers array\n    deleteIndexList.reverse();\n    deleteIndexList.forEach((deleteIndex: number) => {\n      markersList.splice(deleteIndex, 1);\n    });\n\n    // sort again\n    sortMarkersList();\n  }\n\n  // attach hover event handler\n  function registerMarkerTipHandler(markerDiv: Object): void {\n    markerDiv.addEventListener('mouseover', () => {\n      var marker = markersMap[markerDiv.getAttribute('data-marker-key')];\n      if (!!markerTip) {\n        markerTip.querySelector('.vjs-tip-inner').innerText = setting.markerTip.text(marker);\n        // margin-left needs to minus the padding length to align correctly with the marker\n        markerTip.style.left = getPosition(marker) + '%';\n        var markerTipBounding = getElementBounding(markerTip);\n        var markerDivBounding = getElementBounding(markerDiv);\n        markerTip.style.marginLeft = \n          -parseFloat(markerTipBounding.width / 2) + parseFloat(markerDivBounding.width / 4) + 'px';\n        markerTip.style.visibility = 'visible';\n      }\n    });\n\n    markerDiv.addEventListener('mouseout',() => {\n      if (!!markerTip) {\n        markerTip.style.visibility = \"hidden\";\n      }\n    });\n  }\n\n  function initializeMarkerTip(): void {\n    markerTip = videojs.dom.createEl('div', {\n      className: 'vjs-tip',\n      innerHTML: \"<div class='vjs-tip-arrow'></div><div class='vjs-tip-inner'></div>\",\n    });\n    player.el().querySelector('.vjs-progress-holder').appendChild(markerTip);\n  }\n\n  // show or hide break overlays\n  function updateBreakOverlay(): void {\n    if (!setting.breakOverlay.display || currentMarkerIndex < 0) {\n      return;\n    }\n\n    var currentTime = player.currentTime();\n    var marker = markersList[currentMarkerIndex];\n    var markerTime = setting.markerTip.time(marker);\n\n    if (\n      currentTime >= markerTime &&\n      currentTime <= (markerTime + setting.breakOverlay.displayTime)\n    ) {\n      if (overlayIndex !== currentMarkerIndex) {\n        overlayIndex = currentMarkerIndex;\n        if (breakOverlay) {\n          breakOverlay.querySelector('.vjs-break-overlay-text').innerHTML = setting.breakOverlay.text(marker);\n        }\n      }\n\n      if (breakOverlay) {\n        breakOverlay.style.visibility = \"visible\";\n      }\n    } else {\n      overlayIndex = NULL_INDEX;\n      if (breakOverlay) {\n        breakOverlay.style.visibility = \"hidden\";\n      }\n    }\n  }\n\n  // problem when the next marker is within the overlay display time from the previous marker\n  function initializeOverlay(): void {\n    breakOverlay = videojs.dom.createEl('div', {\n      className: 'vjs-break-overlay',\n      innerHTML: \"<div class='vjs-break-overlay-text'></div>\"\n    });\n    Object.keys(setting.breakOverlay.style).forEach(key => {\n      if (breakOverlay) {\n        breakOverlay.style[key] = setting.breakOverlay.style[key];\n      }\n    });\n    player.el().appendChild(breakOverlay);\n    overlayIndex = NULL_INDEX;\n  }\n\n  function onTimeUpdate(): void {\n    onUpdateMarker();\n    updateBreakOverlay();\n    options.onTimeUpdateAfterMarkerUpdate && options.onTimeUpdateAfterMarkerUpdate();\n  }\n\n  function onUpdateMarker() {\n    /*\n      check marker reached in between markers\n      the logic here is that it triggers a new marker reached event only if the player\n      enters a new marker range (e.g. from marker 1 to marker 2). Thus, if player is on marker 1 and user clicked on marker 1 again, no new reached event is triggered)\n    */\n    if (!markersList.length) {\n      return;\n    }\n\n    var getNextMarkerTime = (index: number) => {\n      if (index < markersList.length - 1) {\n        return setting.markerTip.time(markersList[index + 1]);\n      }\n      // next marker time of last marker would be end of video time\n      return player.duration();\n    }\n    var currentTime = player.currentTime();\n    var newMarkerIndex = NULL_INDEX;\n\n    if (currentMarkerIndex !== NULL_INDEX) {\n      // check if staying at same marker\n      var nextMarkerTime = getNextMarkerTime(currentMarkerIndex);\n      if(\n        currentTime >= setting.markerTip.time(markersList[currentMarkerIndex]) &&\n        currentTime < nextMarkerTime\n      ) {\n        return;\n      }\n\n      // check for ending (at the end current time equals player duration)\n      if (\n        currentMarkerIndex === markersList.length - 1 &&\n        currentTime === player.duration()\n      ) {\n        return;\n      }\n    }\n\n    // check first marker, no marker is selected\n    if (currentTime < setting.markerTip.time(markersList[0])) {\n      newMarkerIndex = NULL_INDEX;\n    } else {\n      // look for new index\n      for (var i = 0; i < markersList.length; i++) {\n        nextMarkerTime = getNextMarkerTime(i);\n        if (\n          currentTime >= setting.markerTip.time(markersList[i]) &&\n          currentTime < nextMarkerTime\n        ) {\n          newMarkerIndex = i;\n          break;\n        }\n      }\n    }\n\n    // set new marker index\n    if (newMarkerIndex !== currentMarkerIndex) {\n      // trigger event if index is not null\n      if (newMarkerIndex !== NULL_INDEX && options.onMarkerReached) {\n        options.onMarkerReached(markersList[newMarkerIndex], newMarkerIndex);\n      }\n      currentMarkerIndex = newMarkerIndex;\n    }\n  }\n\n  // setup the whole thing\n  function initialize(): void {\n    if (setting.markerTip.display) {\n      initializeMarkerTip();\n    }\n\n    // remove existing markers if already initialized\n    player.markers.removeAll();\n    addMarkers(setting.markers);\n\n    if (setting.breakOverlay.display) {\n      initializeOverlay();\n    }\n    onTimeUpdate();\n    player.on(\"timeupdate\", onTimeUpdate);\n    player.off(\"loadedmetadata\");\n  }\n\n  // setup the plugin after we loaded video's meta data\n  player.on(\"loadedmetadata\", function() {\n    initialize();\n  });\n\n  // exposed plugin API\n  player.markers = {\n    getMarkers: function(): Array<Marker> {\n      return markersList;\n    },\n    next : function(): void {\n      // go to the next marker from current timestamp\n      const currentTime = player.currentTime();\n      for (var i = 0; i < markersList.length; i++) {\n        var markerTime = setting.markerTip.time(markersList[i]);\n        if (markerTime > currentTime) {\n          player.currentTime(markerTime);\n          break;\n        }\n      }\n    },\n    prev : function(): void {\n      // go to previous marker\n      const currentTime = player.currentTime();\n      for (var i = markersList.length - 1; i >= 0 ; i--) {\n        var markerTime = setting.markerTip.time(markersList[i]);\n        // add a threshold\n        if (markerTime + 0.5 < currentTime) {\n          player.currentTime(markerTime);\n          return;\n        }\n      }\n    },\n    add : function(newMarkers: Array<Marker>): void {\n      // add new markers given an array of index\n      addMarkers(newMarkers);\n    },\n    remove: function(indexArray: Array<number>): void {\n      // remove markers given an array of index\n      removeMarkers(indexArray);\n    },\n    removeAll: function(): void {\n      var indexArray = [];\n      for (var i = 0; i < markersList.length; i++) {\n        indexArray.push(i);\n      }\n      removeMarkers(indexArray);\n    },\n    // force - force all markers to be updated, regardless of if they have changed or not.\n    updateTime: function(force: boolean): void {\n      // notify the plugin to update the UI for changes in marker times\n      updateMarkers(force);\n    },\n    reset: function(newMarkers: Array<Marker>): void {\n      // remove all the existing markers and add new ones\n      player.markers.removeAll();\n      addMarkers(newMarkers);\n    },\n    destroy: function(): void {\n      // unregister the plugins and clean up even handlers\n      player.markers.removeAll();\n      breakOverlay && breakOverlay.remove();\n      markerTip && markerTip.remove();\n      player.off(\"timeupdate\", updateBreakOverlay);\n      delete player.markers;\n    },\n  };\n}\n\nvideojs.registerPlugin('markers', registerVideoJsMarkersPlugin);\n"]}