How to use the clappr.Events function in clappr

To help you get started, we’ve selected a few clappr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github destruc7i0n / nani / src / components / Video / Video.js View on Github external
},
        disableVideoTagContextMenu: true
      })
      this.player.on(Clappr.Events.PLAYER_PLAY, () => {
        // seek video on first player play, this will fix it on mobile too!
        if (media.playhead && !this.seeked) {
          this.player.seek(media.playhead)
        }
        // run the callback
        playCallback()
        this.seeked = true
      })
      this.player.on(Clappr.Events.PLAYER_PAUSE, () => {
        this.logTime()
      })
      this.player.on(Clappr.Events.PLAYER_ENDED, () => {
        this.logTime(media.duration)
      })
      this.player.on(Clappr.Events.PLAYER_ERROR, (error) => console.error('Error', error))
    }
  }
github destruc7i0n / nani / src / components / Video / Video.js View on Github external
seriesTitle: media.collection_name,
            episode: media.episode_number || null
          }
        },
        playbackRateConfig: {
          defaultValue: '1.0',
          options: [
            {value: '0.5', label: '0.5x'},
            {value: '1.0', label: '1x'},
            {value: '1.5', label: '1.5x'},
            {value: '2.0', label: '2x'}
          ]
        },
        disableVideoTagContextMenu: true
      })
      this.player.on(Clappr.Events.PLAYER_PLAY, () => {
        // seek video on first player play, this will fix it on mobile too!
        if (media.playhead && !this.seeked) {
          this.player.seek(media.playhead)
        }
        // run the callback
        playCallback()
        this.seeked = true
      })
      this.player.on(Clappr.Events.PLAYER_PAUSE, () => {
        this.logTime()
      })
      this.player.on(Clappr.Events.PLAYER_ENDED, () => {
        this.logTime(media.duration)
      })
      this.player.on(Clappr.Events.PLAYER_ERROR, (error) => console.error('Error', error))
    }
github sonnylazuardi / bibleify-desktop / src / components / player.js View on Github external
componentDidMount() {
    this.player = new Clappr.Player({
      parent: this.playerRef,
      source: '',
      width: '0',
      height: '0',
      autoPlay: false,
      hlsjsConfig: {
        enableWorker: true,
      },
    });
    const Events = Clappr.Events;
    this.player.on(Events.PLAYER_TIMEUPDATE, progress => {
      this.props.dispatch.player.setTime({ currentTime: progress.current, totalTime: progress.total });
    });

    this.player.on(Events.PLAYER_ENDED, () => {
      const { repeat } = this.props.player;
      if (repeat) {
        this.onPlayNext();
      } else {
        this.props.dispatch.player.setPaused(true);
      }
    });
  }
github Paratii-Video / paratii-mediaplayer / src / js / controls.js View on Github external
addEventListeners() {
    super.addEventListeners();
    if (this.container) {
      this.listenTo(
        this.container,
        Clappr.Events.CONTAINER_PLAY,
        this.updatePlayPauseButton
      );
      this.listenTo(
        this.container,
        Clappr.Events.CONTAINER_PAUSE,
        this.updatePlayPauseButton
      );
    }
  }