npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-bridtv-sdk-module

v1.0.7

Published

React native module for Android/IOS BridTV SDK

Downloads

124

Readme

react-native-bridtv-sdk-module

BridTV SDK player for react native

Installation

npm install react-native-bridtv-sdk-module
or 
yarn add react-native-bridtv-sdk-module


IOS 

After NPM, cd to IOS and run  pod install

Android 

To update dependencies and fetch the latest packages open Android Studio and run Gradle Sync. By performing the Gradle sync, you ensure that your Android project is up to date with the latest packages and dependencies, which can help resolve compatibility issues and provide access to new features and bug fixes.

Usage

import { BridPlayer } from "react-native-bridtv-sdk-module";

// ...
const App = () => {
  const bridPlayerRef = React.useRef<BridPlayer>(null);

  const handleAllPlayerEvents = (eventData) => {
     console.log(eventData);
  };

  const handleVideoLoad = (eventData) => {cd
    console.log('VIDEO LOADED' + '-' + eventData.playerReference);
  };

          <BridPlayer
            ref={bridPlayerRef3}
            style={styles.square}
            bridPlayerConfig={{
              playerReference: 'player_3', // Player reference important for Events
              playerID: xxxx, // PlayerID from BridTV cms
              mediaID: xxxxxxxx, //VideoID or PlaylistID from BridTv cms
              typeOfPlayer: 'Single', // Single or Playlist
              controlAutoplay: false, //enables the client to take control over autoplay
              scrollOnAd: true, //This option enables scrolling during ad and is specific to the iOS platform. By default, Android has scrolling enabled during ads.
              creditsLabelColor: '614BC3', // To achieve color modification for credits label, it is necessary to provide a sequence of six hexadecimal characters, excluding the '#' symbol.
              setCornerRadius: 30, //This property enables setting the corner radius to the player itself. Its value is in pixels.
              localization: 'en', //This property allows selecting the language in which the player and IMA will operate.

            }}
            //Callback for Events from all players in one Activity {"message": "video/ad event", "playerReference": "reverence to player from props"}
            handleAllPlayerEvents={(eventData) =>handleAllPlayerEvents(eventData)}
            //Video
            handleVideoLoad={(eventData) => handleVideoLoad(eventData)}
            handleVideoStart={(eventData) => handleVideoStart(eventData)}
            //Error
            handleVideoError={(eventData) => handleVideoError(eventData)}
          />

Props

The BridPlayer component accepts the following props:

  • style (optional): Specifies the style for the player component.

  • bridPlayerConfig: An object that contains configuration options for the player. It includes properties playerID, mediaID, typeOfPlayer, useVPAIDSupport, playerReference, controlAutoplay, scrollOnAd, creditsLabelColor, setCornerRadius, localization. Explanations for each of the properties are given in the section above.

  • localization - Supported languages::

    • en (English) - default
    • es (Spanish)
    • de (German)
    • fr (French)
    • it (Italian)
    • ru (Russian)
    • pt (Portuguese)
    • sr (Serbian)
    • me (Montenegrin)
    • hr (Croatian)
    • bs (Bosnian)
    • sl (Slovenian)
  • handleAllPlayerEvents : Callback for Events from all players in one Activity {"name": "video/ad event", "playerReference": "reverence to player from props"}

  • Video event callbacks: These props allow you to specify callback functions for various video events like:

    • handleVideoLoad,
    • handleVideoStart,
    • handleVideoPlay,
    • handleVideoBuffering,
    • handleVideoProgress,
    • handleVideoPaused,
    • handleVideoEnd,
    • handleVideoSeek,
    • handleFullscreenOpen,
    • handleFullscreenClose,
    • handleVideoAutoplay
  • Ad event callbacks: These props allow you to specify callback functions for various ad events like:

    • handleVideoAdLoaded,
    • handleVideoAdCompleted,
    • handleVideoAdResumed,
    • handleVideoAdStart,
    • handleVideoAdPaused,
    • handleAdProgress,
    • handleVideoAdTapped,
    • handleVideoAdSkipped,
    • handleVideoAdEnd
  • handleVideoError: A callback function that handles video errors. It receives an errorEvent object. These are the error event types that can occur with the BridPlayer:

    • adError:

      • Name: adError
      • Message: Error occurred during ad playback.
      • Code: 300
    • videoBadUrl:

      • Name: playerVideoBadUrl
      • Message: Invalid video from BridTv CMS/Invalid video URL.
      • Code: 101
    • unsupportedFormat:

      • Name: playerUnsupportedFormat
      • Message: Video player error. Probably unsupported video format.
      • Code: 102
    • protectedContent:

      • Name: playerProtectedContent
      • Message: Cannot play protected content.
      • Code: 103
    • lostIntenetConnection:

      • Name: playerLostInternetConnection
      • Message: Lost internet connection.
      • Code: 100
    • liveStreamError:

      • Name: playerLivestreamError
      • Message: An error occurred during live stream playback.
      • Code: 200

These error types represent various issues that can occur during the playback of videos or ads with the BridPlayer. By handling these error events appropriately, you can provide better error feedback and take necessary actions to address the specific error conditions encountered during playback.

Methods

  • play(): void: Plays the video.
  • pause(): void: Pauses the video.
  • previous(): void: Plays the previous video in the playlist.
  • next(): void: Plays the next video in the playlist.
  • mute(): void: Mutes the video.
  • unMute(): void: Unmutes the video.
  • loadVideo(playerID: number, mediaID: number): void: Loads a video with the specified playerID and mediaID from BridTv CMS.
  • loadPlaylist(playerID: number, mediaID: number): void: Loads a playlist with the specified playerID and mediaID from BridTv CMS.
  • setFullscreen(fullscreen: boolean): void: Sets the fullscreen mode of the player. Pass true to enter fullscreen mode or false to exit fullscreen mode.
  • showControls(): void: Enable the video controls.
  • hideControls(): void: Disable the video controls.
  • showPoster(): void: Show video thumbnail.
  • hidePoster(): void: Hide video thumbnail.
  • **isPlayingAd(): Promise**Checks if an ad is currently playing.
  • getPlayerCurrentTime(): Promise<number | null>: Retrieves the current playback time of the player in milliseconds. Returns a promise that resolves with the current time or null if the player is not loaded.
  • getAdDuration(): Promise<number | null>: Retrieves the duration of the currently playing ad in milliseconds. Returns a promise that resolves with the ad duration or null if no ad is playing.
  • getVideoDuration(): Promise<number | null>: Retrieves the duration of the currently loaded video in milliseconds. Returns a promise that resolves with the video duration or null if no video is loaded.
  • isPaused(): Promise: Checks if the video is currently paused.
  • isRepeated(): Promise: Checks if the video is already repeated.
  • destroyPlayer(): void: Destroys the native player instance and cleans up any resources associated with it.
  • isAutoplay(): Promise: Method is used to check if the current video is set to autoplay..

Please note that these methods should be called on an instance of the BridPlayer class.

Take a look at our Example App for best practices while implementing BridPlayer RN module.

Contributing

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

License

MIT


Made by Brid.tv