Socket
Socket
Sign inDemoInstall

react-native-nexen-player

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-nexen-player

next generation video player for react native


Version published
Maintainers
1
Created

Readme

Source

react-native-nexen-player

A next generation video player for react native app based on react-native-video. It provides advanced media control functionality.

Preview

@

Installation

npm install react-native-nexen-player

or

yarn add react-native-nexen-player

Dependencies

yarn add react-native-video react-native-svg

Usage

import NexenPlayer, { NexenPlayerRef } from 'react-native-nexen-player';

// ...

const [paused, setPaused] = React.useState(true);
const playerRef = React.useRef<NexenPlayerRef>(null);

const onPausePress = () => {
    if (paused) {
      playerRef.current?.play();
    } else {
      playerRef?.current?.pause();
    }
    setPaused((prevState) => !prevState);
  };

<NexenPlayer
    ref={playerRef}
    style={styles.player}
    playerSource={{
      source: require('../assets/videos/Street_Fighter_V_Stop_Motion.mp4'),
      poster: 'https://img.youtube.com/vi/KrmxD8didgQ/0.jpg',
      title: "Ryu's Hurricane Kick and Hadoken",
    }}
    />

// ...

Component props

proptypedefaultdescription
playerSourceNexenPlayer PlayerSource object{}media source.
playerConfigNexenPlayer PlayerConfig object''vidoe player config.
optimizationConfigNexenPlayer OptimizationConfig object{}only for FlatList Optimization.
insetsobject{}edge insets for video controls. you can set insets from react-native-safe-area-context.
styleobject{}style for video player.
themeobject{}set theme for video player.

PlayerSource

proptypedefaultdescription
sourceSource{}media source.
titlestringundefinedvideo title.
posterstringundefinedposter url.
playlist{ items: PlaylistItem[]; currentIndex?: number; }{}poster style.
textTracksTextTrack[]undefinedtext tracks (cations or subtitle) for the video.
selectedTextTrackSelectedTextTrackundefinedtext trak that will be shown for the video.
selectedAudioTrackSelectedAudioTrackundefinedaudio track that will be selected for the video.

PlayerConfig

proptypedefaultdescription
loaderTextstring'Loading...'text for loader.
errorTextstring'Error...!'text for error message.
doubleTapTimenumber300msduration of double tap.
controlTimeoutnumber500msmain control will hide after this amount of time when controlHideMode set to 'auto'.
controlHideModestring'touch'hide options for main control - 'touch' or 'auto'.
layoutModestirng'basic'options for main control layout - 'basic', 'intermediate' or 'advanced'.
resizeModeResizeMode object'contain'video resize options.
posterResizeModeResizeMode object'cover'poster resize options.
volumenumber80volume of the video (0-100).
brightnessnumber25brightness of the video (0-100).
playbackSpeedPlaybackSpeed objecj'1.0'video playback speed.
mutedbooleanfalsemute video.
repeatbooleanfalserepeat video.
autoPlaybooleanfalseshould autoplay the video.
disableOnScreenPlayButtonbooleanfalsea large play button that appears on screen when video is paused.
disableBackbooleanfalsehide back button.
disableResizeModebooleanfalsehide aspect ration button.
disableVolumebooleanfalsehide volume button.
disableMorebooleanfalsehide more button.
disableSkipbooleanfalsehide skip buttons.
disableStopbooleanfalsehide stop button.
disableFullscreenbooleanfalsehide fullscreen button.
disablePlaylistboolean() => {}hide video playlist button.
indexnumber0flatlist index (only for FlatList)
activeIndexnumber-1flatlist current video index (only for FlatList)
optimizebooleanfalsewheather you need flatlist optimization or not (only for FlatList)

Enevt props

proptypedefaultdescription
onBackPressedfunc() => {}callback for back button.
onPlayfunc() => {}callback for play button.
onPausefunc() => {}callback for pause button.
onStopfunc() => {}callback for stop button.
onSkipNextfunc() => {}callback for skipNext event.
onSkipBackfunc() => {}callback for skipBack event.
onReloadfunc() => {}callback for reload event.
onVolumeUpdatefunc() => {}callback for volume update event.
onBrightnessUpdatefunc() => {}callback for brightness update event.
onMuteUpdatefunc() => {}callback for mute button.
onLoopUpdatefunc() => {}callback for loop button.
onSpeedUpdatefunc() => {}callback for playback speed update event.
onFullScreenModeUpdatefunc() => {}callback for fullscreen mode update event.
onScreenLockUpdatefunc() => {}callback for screen lock update event.
onPlaylistItemSelectfunc() => {}callback for video list item select event.

Methods

proptypedefaultdescription
playfunc() => {}call to play a video.
pausefunc() => {}call to pause a video.
stopfunc() => {}call to stop a video.
skipNextfunc() => {}skip to next video.
skipBackfunc() => {}skip to prvious video.
reloadfunc() => {}call to reload a video.
loadfunc() => {}call to load a video.
setFullScreenModefunc() => {}set fullscreen mode.

ToDo

-[] Custom icon support

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Last updated on 24 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc