Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

byteark-player-react

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

byteark-player-react

ByteArk Player Container for React

  • 1.0.0-beta1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
213
decreased by-52.98%
Maintainers
1
Weekly downloads
 
Created
Source

ByteArk Player Container for React

NPM JavaScript Style Guide

Features

  • Remote player updates. No need to update your code for minor improvements.
  • Using placeholder to maintain page's layout before the player ready.
  • Controls basic behaviours via props.
  • Custom advance behaviours via callbacks to access ByteArk Player/VideoJS instance directly.

Installation

This library is distributed via NPM. You may install from NPM or Yarn.

# For NPM
npm install --save byteark-player-react
# For Yarn
yarn add byteark-player-react

Usage

Include ByteArkPlayerContainer component into your component.

import React from 'react'
import { render } from 'react-dom'
import { ByteArkPlayerContainer } from 'byteark-player-react'

const App = () => {
  const playerOptions = {
    autoplay: true,
    fluid: true,
    sources: {
      src: 'https://video.example.com/path/to/video/playlist.m3u8',
      type: 'application/x-mpegURL',
      // Optional
      title: 'Video Title'
    }
  }
  return <ByteArkPlayerContainer {...playerOptions} />
}

render(<App />, document.getElementById('root'))

Basic Props

Following properties are the properties that can be updated to the player, without re-creating the player instance. Additional properties will be passed to player.

NameTypeDefaultDescription
autoplayBooleantrueAutoplay the video after player is created.
aspectRatioString-Use with fluid layout mode, to inform expected video's aspect ratio (16:9)
controlsBooleantrueShow/hide the controls bar.
fillBoolean-Use fill layout mode.
fluidBoolean-Use fluid layout mode.
loopBoolean-Restart the video playback after plays to the end.
mutedBoolean-Play the video without sounds.
playerVersionString1.0Version of the player to use.
playbackRateNumber1.0Playback speed. 1.0 means original speed.
playsinlineBooleantrueShould be true so custom controls available on all platforms, including iOS.
posterString-Image to be show before the video is playing.
preloadString-Preload the video before play. (none
responsiveBoolean-Auto show/hide controls depending on the screen size.
sourcesObject/Array-Source of videos to be played.
volumeNumber-Video's volume, between 0 to 1.

Source Props

The sources object has 2 fields:

NameTypeDescription
srcStringURL to the video.
typeStringVideo content type.

To provide multiple version of sources, you can use array of source objects.

Callback Props

We also provide some callback properties, so you can inject some behaviours directly to the ByteArk Player, and also, to the VideoJS's instance.

NameTypeCallback ParametersDescription
onPlayerCreatedFunction(player)Callback function to be called when a player instance is created.
onPlayerLoadingErrorFunction({ code, message })Callback function to be called when there're an error about loading player.
onPlayerReadyFunction(player)Callback function to be called when a player instance is ready.

Advance Props

We also provide some ways to custom the appearance of the video placeholder, and some advance behaviours.

NameTypeDescription
createPlaceholderFunctionFunctionCustom video placeholder. This function should return a React component.
createPlayerFunctionFunctionCustom video instance. This function should return a VideoJS's player instance.
playerEndpointStringEndpoint to the video player (without version part).
playerJsFileNameStringFile name of player's JS.
playerCssFileNameStringFile name of player's CSS.

License

MIT © ByteArk Co. Ltd.

FAQs

Package last updated on 27 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc