Socket
Book a DemoInstallSign in
Socket

@csod-oss/react-video-js-player

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@csod-oss/react-video-js-player

React wrapper for VideoJS

unpublished
latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
3
Created
Source

@csod-oss/react-video-js-player

React wrapper for VideoJS. Live Demo

Install

npm install --save @csod-oss/react-video-js-player

Usage

import React, { Component } from 'react';
import VideoPlayer from '@csod-oss/react-video-js-player';

class VideoApp extends Component {
  player = {};
  state = {
    video: {
      src: 'http://www.example.com/path/to/video.mp4',
      poster: 'http://www.example.com/path/to/video_poster.jpg'
    }
  };

  onPlayerReady(player) {
    console.log('Player is ready: ', player);
    this.player = player;
  }

  onVideoPlay(duration) {
    console.log('Video played at: ', duration);
  }

  onVideoPause(duration) {
    console.log('Video paused at: ', duration);
  }

  onVideoTimeUpdate(duration) {
    console.log('Time updated: ', duration);
  }

  onVideoSeeking(duration) {
    console.log('Video seeking: ', duration);
  }

  onVideoSeeked(from, to) {
    console.log(`Video seeked from ${from} to ${to}`);
  }

  onVideoEnd() {
    console.log('Video ended');
  }

  render() {
    return (
      <div>
        <VideoPlayer
          controls={true}
          src={this.state.video.src}
          poster={this.state.video.poster}
          width='720'
          height='420'
          onReady={this.onPlayerReady.bind(this)}
          onPlay={this.onVideoPlay.bind(this)}
          onPause={this.onVideoPause.bind(this)}
          onTimeUpdate={this.onVideoTimeUpdate.bind(this)}
          onSeeking={this.onVideoSeeking.bind(this)}
          onSeeked={this.onVideoSeeked.bind(this)}
          onEnd={this.onVideoEnd.bind(this)}
        />
      </div>
    );
  }
}
export default VideoApp;

VideoJS APIs support:

onReady will return videojs instance. Which means you can use all the APIs provided by VideoJS.
List of VideoJS APIs

VideoJS plugins support:

Since most of the VideoJS plugins needs videojs instance to get initialized, it is very easy to integrate any of the available plugins by making use of videojs instance returnd by onReady event.
List of VideoJS plugins

Available Props:

Prop NameProp TypeDefault ValueDescription
autoplaybooleanfalseVideo will start playing automatically if true
bigPlayButtonbooleantrueBig play button visibility toggle
bigPlayButtonCenteredbooleantrueBig play button center position toggle
classNamestring""Video player wrapper class. It can be used for custom player skin.
controlsbooleantrueVideo player control bar toggle
heightstring | numberautoVideo player height
hideControlsarray[]List of controls to hide. ['play','volume','seekbar','timer','playbackrates','fullscreen']
playbackRatesarray[0.5, 1, 1.5, 2]Video speed control
preloadstringautovideo tag preload attribute
posterstring""Video poster file path
srcstring""Video file path
widthstring | numberautoVideo player width
withCredentialsbooleantrueWhen the withCredentials property is set to true, all XHR requests for manifests and segments would have withCredentials set to true as well. This enables storing and passing cookies from the server that the manifests and segments live on. This has some implications on CORS because when set, the Access-Control-Allow-Origin header cannot be set to *, also, the response headers require the addition of Access-Control-Allow-Credentials header which is set to true. See html5rocks's article for more info.

Video tracking props:

Method NameDescription
onEndIt will fire when video is finished playing.
onPauseIt will fire when video is paused. It returns current time of the video
onPlayIt will fire when video starts playing anytime. It returns current time of the video
onReadyIt will fire when video player is ready to be used. It returns videojs instance.
onSeekedIt will fire after seeking is done. It returns seek start time and seek end time for the video.
onSeekingIt will fire when video is being seeked using seekbar. It returns current time of the video
onTimeUpdateIt keeps firing while video is in playing state. It returns current time of the video

Keywords

react-video-js-player

FAQs

Package last updated on 11 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts