1.5.15 • Published 5 years ago

@onytgvx/expo-video-player v1.5.15

Weekly downloads
17
License
MIT
Repository
-
Last release
5 years ago

Basic info

Video component for Expo built on default Video component. Inspired by expo/videoplayer (already deprecated)

The library has a lot of options, but most of them are optional (source and inFullscreen are required). See the props table below. The Video component also supports phones, which screen ratio is not 16:9.

Installation

yarn add expo-video-player or npm install expo-video-player

If you are using TypeScript, type definitions are in the project itself.

Usage

Example app can be found in the folder example-app.

import { Video } from 'expo-av'
import VideoPlayer from 'expo-video-player'

<VideoPlayer
  videoProps={{
    shouldPlay: true,
    resizeMode: Video.RESIZE_MODE_CONTAIN,
    source: {
      uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
    },
  }}
  inFullscreen={true}
/>

Props

proptypedefaultrequireddescription
debugbooleanfalse:x:Write internal logs to console
VIDEO PROPS
videoPropsVideoProps{}:heavy_check_mark:Video props to Expo component (at least source is required)
inFullscreenboolean:heavy_check_mark:Specify if video is inFullscreen (show enter/leave fullscreen icons)
isPortrait (@deprecated - will be removed in next major version)boolean:heavy_check_mark:Specify orientation of the video
widthnumberDimensions.get('window').width:x:Specify width of the video (automatically set height based on screen ratio)
heightnumberDimensions.get('window').height:x:Specify height (automatically set width based on screen ratio)
ANIMATIONS
fadeInDurationnumber200:x:How long should the fadeIn animation for the controls run? (in milliseconds)
fadeOutDurationnumber1000:x:How long should the fadeOut animation run? (in milliseconds)
hideControlsTimerDurationnumber4000:x:If the user has not interacted with the controls, how long should the controls stay visible? (in milliseconds) Default value is 4000.
quickFadeOutDurationnumber200:x:How long should the fadeOut animation run when the screen is tapped when the controls are visible?
ICONS
fullscreenEnterIconJSX.ElementFullscreenEnterIcon:x:Default icon for entering fullscreen video
fullscreenExitIconJSX.ElementFullscreenExitIcon:x:Default icon for exiting fullscreen video
playIconJSX.ElementPlayIcon:x:Default icon for playing the video
pauseIconJSX.ElementPauseIcon:x:Default icon for pausing the video
replayIconJSX.ElementReplayIcon:x:Default icon for replaying the video
spinnerJSX.ElementReplayIcon:x:Default icon for pausing the video
showFullscreenButtonbooleantrue:x:Boolean indicating whether fullscreen icon should be visible
APPEARANCE
iosThumbImagesourceimage:x:iOS thumbImage
iosTrackImagesourceimage:x:iOS trackImage
showControlsOnLoadbooleanfalse:x:Boolean indicating whether controls should be visible on load
sliderColorcolor#009485:x:Color for ANDROID thumbTintColor and iOS minimumTrackImage
textStyleTextStyle{color: '#FFF', fontSize: 12}:x:Default styling for text (eg. errors)
videoBackgroundcolor#000:x:Default background around video
CALLBACKS
errorCallbackfunctionerror => console.error('Error: ', error.message, error.type, error.obj):x:Function when an error occurs
playbackCallbackfunctioncallback => {}:x:Function when playing changes (buffering/seeking/...)
switchToPortraitfunction() => console.warn('Pass in this function 'switchToPortrait' in props to enable fullscreening'):x:Pass your function to make something on click (eg. rotate phone)
switchToLandscapefunction() => console.warn('Pass in this function 'switchToLandscape' in props to enable fullscreening'):x:Pass your function to make something on click (eg. rotate phone)

CHANGELOG

Changelog added in version 1.3.0 Read CHANGELOG.md

TODO

  • make better example app
  • make tests

Some articles

1.5.15

5 years ago

1.5.14

5 years ago

1.5.13

5 years ago

1.5.12

5 years ago

1.5.11

5 years ago

1.5.10

5 years ago

1.5.9

5 years ago

1.5.8

5 years ago

1.5.7

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago