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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@xymatic/react-native-green-video

v2.0.80

Published

React-native wrapper for green-video SDK

Readme

react-native-green-video

React Native wrapper for the GreenVideo SDK.

[TOC]

Installation

Yarn

Run this command:

yarn add @xymatic/react-native-green-video

npm

Run this command:

npm install @xymatic/react-native-green-video

iOS

In your ios/Podfile raise your minimum supported iOS version to 14.0 by changing this line:

platform :ios, min_ios_version_supported

to:

platform :ios, 14.0

Run pod install --repo-update in your ios subdirectory.

Android

Generally, Android should work out of the box without any changes needed. If you are getting an error about kotlin version mismatch, set a matching version inside android/build.gradle file in buildscript > ext for example:

kotlinVersion = "2.1.0"

Upgrading

Note that yarn will save the commit SHA in yarn.lock. In order to get the latest version from the main branch, you will have to delete the lockfile, remove the entry, or re-install the package.

Usage

Example

Make sure to set your own embedId and licenseKey.

import * as React from 'react';

import {
  Dimensions,
  Button,
  ActivityIndicator,
  StyleSheet,
  View,
} from 'react-native';
import {GreenVideo, type TimeUpdate} from '@xymatic/react-native-green-video';

import {
  defaultEmbedId,
  defaultContentId,
  defaultLicenseKey,
} from './src/constants';

const Example = () => {
  const [isReady, setIsReady] = React.useState(false);
  const [isPlaying, setIsPlaying] = React.useState(false);
  const [timeInfo, setTimeInfo] = React.useState({
    currentTime: 0,
    duration: 0,
  });
  const testRef = React.useRef<GreenVideo>(null);

  const play = () => {
    testRef?.current?.play();
  };

  const pause = () => {
    testRef?.current?.pause();
  };

  const seek = (position: number) => {
    testRef?.current?.seek(Math.round(position));
  };

  const onPlay = () => {
    setIsPlaying(true);
  };

  const onPause = () => {
    setIsPlaying(false);
  };

  const onReady = () => {
    setIsReady(true);
  };

  const onTimeUpdate = (event: TimeUpdate) => {
    const {currentTime, duration} = event;

    setTimeInfo({
      currentTime,
      duration,
    });
  };

  const renderControls = () => {
    if (isReady) {
      return (
        <View style={styles.buttonContainer}>
          <Button
            onPress={() => seek(timeInfo.currentTime - 15)}
            title="-15s"
          />
          <Button disabled={isPlaying} onPress={play} title="Play" />
          <Button disabled={!isPlaying} onPress={pause} title="Pause" />
          <Button
            onPress={() => seek(timeInfo.currentTime + 15)}
            title="+15s"
          />
        </View>
      );
    }

    return <ActivityIndicator />;
  };

  return (
    <View style={styles.container}>
      <GreenVideo
        ref={testRef}
        licenseKey={defaultLicenseKey}
        embedId={defaultEmbedId}
        contentId={defaultContentId}
        onPlay={onPlay}
        onPause={onPause}
        onReady={onReady}
        onTimeUpdate={onTimeUpdate}
        onSeek={time => console.log(time)}
        onMilestoneReached={milestone => console.log(milestone)}
        style={styles.video}
      />
      {renderControls()}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    width: '100%',
    alignItems: 'center',
    justifyContent: 'center',
  },
  video: {
    marginHorizontal: 8,
    height: Dimensions.get('window').height / 2,
    width: Dimensions.get('window').width - 64,
  },
  buttonContainer: {
    height: 96,
    flexDirection: 'row',
    gap: 16,
  },
});

export default Example;

Props

| Prop | Required | Default | Type | Description | | :-------------------------- | :------: | :-----: | :-------: | :---------------------------------------------------------------- | | licenseKey | yes | none | string | Your Green Video license key | | embedId | yes | none | string | An embed id | | mixId | no | none | string | A mix id. Overrides the value in the configuration | | contentId | no | none | string | A content id | | adTagUrl | no | none | string | Url for getting ad tags | | environment | no | prod | 'staging' \| 'prod' | Which environment to use | | adsDisallowed | no | false | boolean | Disable ads | | debug | no | false | boolean | Enables detailed logging |

Functions

| Function | Arguments | Description | | :-------------------------- | :--------------: | :---------------------------------------------------------------- | | play | none | Start playback | | pause | none | Stop playback | | seek | (position: number) | Seek to position in Video in s | | seekForward | (time: number) | Seek forward from current position | | seekBackward | (time: number) | Seek backward from current position | | mute | none | Mute audio | | unmute | none | Unmute audio | | enterFullscreen | none | Enter fullscreen video | | exitFullscreen | none | Exit fullscreen video | | showUi | none | Show native player controls | | hideUi | none | Hide native player controls | | startContent | (contentIndex: number, startPaused: boolean) | Start a content by index | | startNextContent | none | Start next content | | startPreviousContent | none | Start previous content |

Events

| Events | arguments | Description | | :-------------------------- | :--------------: | :---------------------------------------------------------------- | | onPlay | none | Playback has started | | onPause | none | Playback has paused | | onMute | none | Audio was muted | | onUnmute | none | Audio was unmuted | | onEnterFullscreen | none | Player has entered fullscreen | | onExitFullscreen | none | Player has left fullscreen | | onShowUi | none | Native controls have become visible | | onHideUi | none | Native controls have disappeared | | onReplay | none | Replay has started | | onSeek | none | Seek to position / forward / backward completed | | onTimeUpdate | (timeUpdate: { currentTime: number, duration: number } | Playback time changed | | onMilestoneReached | (milestone: 'ms5' \| 'ms25' \| 'ms50' \| 'ms75' \| 'ms100') | Playback milestone reached |