1.0.4 • Published 9 months ago

rn-yt-player v1.0.4

Weekly downloads
-
License
BSD 2-Clause Lice...
Repository
github
Last release
9 months ago

React Native YouTube Video Player 🔥

This is a plugin for React Native making playing YouTube video in React Native without pain.

It includes almost everything a developer needs to do with a YouTube video in his/her app.

Developers can easily modify the player according to their app (till an extent), and choose options they want to show in YouTube player.

Installation

npm install rn-yt-player react-native-webview

Under the hood this package works with react-native-webview, ie make sure that it is also installed.

Usage

Import the package like below

import YouTubePlayer from 'rn-yt-player';

then simply use the package like below

<YouTubePlayer
    videoSource={VIDEO_SOURCE}
/>

Props

S.N.Prop NameAccepted Data TypeAccepted ValuesDefaultDescription
1videoSourcestringAny Youtube Video URL, it can be directly from Browser or sharable link or URL for embeding video provided by YouTube in embed code or it can also be directly Video IDA Video on YoutubeProvide package the video
2startVideoFromnumber \| stringTime in seconds0Used to set initial point of video, ie video will start from this point to timeframe
3widthnumber \| stringWidth for Video Player"100%"Sets width to Video Player, also accepts string so that you can use percentage relative to parent
4heightnumberHeight for Video Player200Sets height of Video Player. It don't accept string, if you provide it with a string value JavaScript will do something weird.
5accentColorstringcolorDiffersSets colour to seek bar, priotied color to these if these are unset: Initial Play Button
6innerPlayButtonColorstringcolor#FFFFFFSets colour to interior portion (triangle) in Play Button
7playButtonColorstringcolorIf both innerPlayButtonColor and accentColor are unset then #000000 else if playButtonColor is unset then accentColor, if playButtonColor is set then it is only priortied.Sets colour to Play Button (Outer Circle)
8hideYTLogobooleantrue \| falsefalseHides YouTube Logo below seek bar
9hideTopBarbooleantrue \| falsefalseHides top bar in YT Video player, ie it hides Channel Profile Picture, Video Title, copy link button, share video button and 3-dots (more) button
10hideSettingButtonbooleantrue \| falsefalseHides setting button below seek bar
11hideCaptionButtonbooleantrue \| falsefalseHides caption button below seek bar
12hideControlsbooleantrue \| falsefalseHides all controls of Video (Seek Bar, Caption Button, Setting Button, Full Screen Button, Volume Button, Play/Pause button below seek bar)
13childrenReact.ComponentReact.ComponentA default loaderReplaces default loader with your Component until the Video is loaded in Player
14loaderContainerStyleobjectstyleundefinedIt is applied only if you are using custom loader by providing one into children prop. It provides access to styling parent component of loader box which covers Video Player until video is loaded. Hence it can be used to tweak background colour for loader

Example

  • Code
<YouTubePlayer
        videoSource="VIDEO SOURCE"
        innerPlayButtonColor="white"
        hideTopBar={true}
        hideCaptionButton={true}
        hideYTLogo={true}
        accentColor={'green'}
        width="80%"
        height={250}
/>
  • Output
  • Output

Author

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago