src/components/avatar-replayer.js
function () {
    var data = this.data;
    var recordingdb = this.el.systems.recordingdb;;
    var recordingNames;
    var src;
    var self = this;

    // Allow override to display replayer from query param.
    if (new URLSearchParams(window.location.search).get('avatar-replayer-disabled') !== null) {
      return;
    }

    recordingdb.getRecordingNames().then(function (recordingNames) {
      // See if recording defined in query parameter.
      var queryParamSrc = self.getSrcFromSearchParam();

      // 1. Try `avatar-recorder` query parameter as recording name from IndexedDB.
      if (recordingNames.indexOf(queryParamSrc) !== -1) {
        log('Replaying `' + queryParamSrc + '` from IndexedDB.');
        recordingdb.getRecording(queryParamSrc).then(bind(self.startReplaying, self));
        return;
      }

      // 2. Use `avatar-recorder` query parameter or `data.src` as URL.
      src = queryParamSrc || self.data.src;
      if (src) {
        if (self.data.src) {
          log('Replaying from component `src`', src);
        } else if (queryParamSrc) {
          log('Replaying from query parameter `recording`', src);
        }
        self.loadRecordingFromUrl(src, false, bind(self.startReplaying, self));
        return;
      }

      // 3. Use `data.recordingName` as recording name from IndexedDB.
      if (recordingNames.indexOf(self.data.recordingName) !== -1) {
        log('Replaying `' + self.data.recordingName + '` from IndexedDB.');
        recordingdb.getRecording(self.data.recordingName).then(bind(self.startReplaying, self));
      }
    });
  }
function () {
    var data = this.data;
    var recordingdb = this.el.systems.recordingdb;;
    var recordingNames;
    var src;
    var self = this;

    // Allow override to display replayer from query param.
    if (new URLSearchParams(window.location.search).get('avatar-replayer-disabled') !== null) {
      return;
    }

    recordingdb.getRecordingNames().then(function (recordingNames) {
      // See if recording defined in query parameter.
      var queryParamSrc = self.getSrcFromSearchParam();

      // 1. Try `avatar-recorder` query parameter as recording name from IndexedDB.
      if (recordingNames.indexOf(queryParamSrc) !== -1) {
        log('Replaying `' + queryParamSrc + '` from IndexedDB.');
        recordingdb.getRecording(queryParamSrc).then(bind(self.startReplaying, self));
        return;
      }

      // 2. Use `avatar-recorder` query parameter or `data.src` as URL.
      src = queryParamSrc || self.data.src;
      if (src) {
        if (self.data.src) {
          log('Replaying from component `src`', src);
        } else if (queryParamSrc) {
          log('Replaying from query parameter `recording`', src);
        }
        self.loadRecordingFromUrl(src, false, bind(self.startReplaying, self));
        return;
      }

      // 3. Use `data.recordingName` as recording name from IndexedDB.
      if (recordingNames.indexOf(self.data.recordingName) !== -1) {
        log('Replaying `' + self.data.recordingName + '` from IndexedDB.');
        recordingdb.getRecording(self.data.recordingName).then(bind(self.startReplaying, self));
      }
    });
  }
function ( ) { var data = this . data ; var recordingdb = this . el . systems . recordingdb ; ; var recordingNames ; var src ; var self = this ; // Allow override to display replayer from query param. if ( new URLSearchParams ( window . location . search ) . get ( 'avatar-replayer-disabled' ) !== null ) { return ; } recordingdb . getRecordingNames ( ) . then ( function ( recordingNames ) { // See if recording defined in query parameter. var queryParamSrc = self . getSrcFromSearchParam ( ) ; // 1. Try `avatar-recorder` query parameter as recording name from IndexedDB. if ( recordingNames . indexOf ( queryParamSrc ) !== - 1 ) { log ( 'Replaying `' + queryParamSrc + '` from IndexedDB.' ) ; recordingdb . getRecording ( queryParamSrc ) . then ( bind ( self . startReplaying , self ) ) ; return ; } // 2. Use `avatar-recorder` query parameter or `data.src` as URL. src = queryParamSrc || self . data . src ; if ( src ) { if ( self . data . src ) { log ( 'Replaying from component `src`' , src ) ; } else if ( queryParamSrc ) { log ( 'Replaying from query parameter `recording`' , src ) ; } self . loadRecordingFromUrl ( src , false , bind ( self . startReplaying , self ) ) ; return ; } // 3. Use `data.recordingName` as recording name from IndexedDB. if ( recordingNames . indexOf ( self . data . recordingName ) !== - 1 ) { log ( 'Replaying `' + self . data . recordingName + '` from IndexedDB.' ) ; recordingdb . getRecording ( self . data . recordingName ) . then ( bind ( self . startReplaying , self ) ) ; } } ) ; }
Check for recording sources and play.
Check for recording sources and play .