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

bitmovin-player-react-native-analytics-conviva

v1.4.0

Published

Conviva Analytics Integration for the Bitmovin Player React Native SDK

Downloads

238

Readme

Bitmovin Player Conviva Analytics Integration

This is an open-source project to enable the use of a third-party component (Conviva) with the Bitmovin Player React Native SDK.

Maintenance and Update

This project is not part of a regular maintenance or update schedule and is updated once yearly to conform with the latest product versions. For additional update requests, please take a look at the guidance further below.

Contributions to this project

As an open-source project, we are pleased to accept any and all changes, updates and fixes from the community wishing to use this project. Please see CONTRIBUTING.md for more details on how to contribute.

Reporting player bugs

If you come across a bug related to the player, please raise this through your support ticketing system.

Need more help?

Should you want some help updating this project (update, modify, fix or otherwise) and cant contribute for any reason, please raise your request to your bitmovin account team, who can discuss your request.

Support and SLA Disclaimer

As an open-source project and not a core product offering, any request, issue or query related to this project is excluded from any SLA and Support terms that a customer might have with either Bitmovin or another third-party service provider or Company contributing to this project. Any and all updates are purely at the contributor's discretion.

Thank you for your contributions!

Installation

To see how to use the example application, please refer to the example README.

bitmovin-player-react-native-analytics-conviva is available through NPM.

To install it in your project, simply run:

npm install bitmovin-player-react-native-analytics-conviva

or with yarn:

yarn add bitmovin-player-react-native-analytics-conviva

Additionally to install the native dependencies, follow the next steps:

iOS

Simply add the following lines to the top of your Podfile:

source 'https://cdn.cocoapods.org'
source 'https://github.com/bitmovin/cocoapod-specs.git'

The the following line to your desired target:

pod 'BitmovinConvivaAnalytics', git: 'https://github.com/bitmovin/bitmovin-player-ios-analytics-conviva.git', tag: '3.3.2'

Then, in your command line run in your ios folder:

pod repo update
pod install

Android

Add the following to your android/build.gradle:

allprojects {
  repositories {
    ...
    maven { url 'https://artifacts.bitmovin.com/artifactory/public-releases' }
  }
}

Add the following permissions to AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

For more information about permissions and collected network types please look at the Conviva Documentation.

Compatibility

Conviva Analytics Integration depends on bitmovin-player-react-native version >= 0.25.0.

Usage

Basic Setup

The following example shows how to setup the Conviva Analytics integration with the Bitmovin Player React Native SDK:

const player = usePlayer();

const convivaAnalytics = useConvivaAnalytics({
  player: player,
  customerKey: 'YOUR-CONVIVA-CUSTOMER-KEY',
});

const onConvivaSetupError = useCallback((error) => {
  console.error('Conviva error', error);
}, []);

// Initialize ConvivaAnalytics
convivaAnalytics.initialize().catch(onConvivaSetupError);

Cleanup

At the end of the application's lifecycle, release the integration with:

convivaAnalytics.release();

Details about usage of BitmovinPlayer can be found here.

Content Metadata handling

If you want to override some content metadata attributes you can do so by adding the following:

const metadata: ConvivaMetadataOverrides = {
  applicationName: 'Bitmovin iOS Conviva integration example app',
  viewerId: 'awesomeViewerId',
  custom: { custom_tag: 'Episode' },
};
// …
// Initialize ConvivaAnalytics
// …

convivaAnalytics.updateContentMetadata(metadata);

Those values will be cleaned up after the session is closed.

Server Side Ad Tracking

In order to track server side ads you can use the methods provided in SsaiApi which can be accessed via ConvivaAnalytics.ssai. The following example shows basic server side ad tracking:

convivaAnalytics.ssai.reportAdBreakStarted()

const adInfo: SsaiAdInfo = {
    title: "My ad title",
    position: SsaiAdPosition.PREROLL,
    duration: 30,
}
convivaAnalytics.ssai.reportAdStarted(adInfo)

...

convivaAnalytics.ssai.reportAdFinished()
convivaAnalytics.ssai.reportAdBreakFinished()

In addition to the metadata provided in the SsaiAdInfo object at ad start, the following metadata will be auto collected from the main content metadata:

  • Stream URL
  • Asset Name
  • Is live flag
  • Default resource
  • encoded frame rate
  • streamType
  • integrationVersion
  • viewer ID
  • player name

Metadata in the SsaiAdInfo overwrites all auto collected metadata.

Background handling

If your app stops playback when entering background Conviva suggests to end the active session. Since the integration can't know if you app supports playback in background this can't be done automatically.

To end a session use:

convivaAnalytics.endSession();

Since the BitmovinPlayer automatically pauses the video if no background playback is supported the session creation after the app is in foreground again is handled automatically.

UI events (iOS and tvOS only)

If you want to track UI related events such as full-screen state changes add the following after initializing the PlayerView with a viewRef parameter like:

const playerViewRef = useRef(null);
const player = usePlayer();

useEffect(() => {
  convivaAnalytics.setPlayerViewRef(playerViewRef);
}, [convivaAnalytics]);

<PlayerView viewRef={playerViewRef} player={player} />;

Consecutive playback

If you want to use the same player instance for multiple playback, just load a new source with player.load(…). The integration will close the active session.

player.load(…);

External VST tracking

If your app needs additional setup steps which should be included in VST tracking, such as DRM token generation, before the Player instance can be initialized, the ConvivaAnalytics can be initialized without a Player instance. Once the Player instance is created it can be attached.

  1. Create the ConvivaAnalytics instance with your customerKey.
const convivaAnalytics = useConvivaAnalytics({
  customerKey: 'YOUR-CONVIVA-CUSTOMER-KEY',
});

const onConvivaSetupError = useCallback((error) => {
  console.error('Conviva error', error);
}, []);

// Initialize ConvivaAnalytics
convivaAnalytics.initialize().catch(onConvivaSetupError);
  1. Conviva requires that the assetName is set at session initialization. Therefore ensure that you provide using the ConvivaAnalytics.updateContentMetadata() before initializing the tracking session.
convivaAnalytics.updateContentMetadata({
  assetName: 'Your Asset Name',
});

// Initialize tracking session
convivaAnalytics.initializeSession();
  1. Once your Player instance is ready attach it to the ConvivaAnalytics instance.
// ... Additional setup steps

const player = usePlayer();
convivaAnalytics.attachPlayer(player);