bitmovin-player-react-native
Version:
Official React Native bindings for Bitmovin's mobile Player SDKs.
57 lines (56 loc) • 1.95 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const withBitmovinIosConfig_1 = __importDefault(require("./withBitmovinIosConfig"));
const withBitmovinAndroidConfig_1 = __importDefault(require("./withBitmovinAndroidConfig"));
const defaultFeatures = {
airPlay: false,
backgroundPlayback: false,
googleCastSDK: undefined,
offline: false,
pictureInPicture: false,
};
/**
* Expo Config Plugin for Bitmovin Player.
* This plugin configures the Bitmovin Player for both iOS and Android platforms.
* It accepts a player license key and feature flags to customize the player's behavior.
* @param config - The Expo config object.
* @param options - An object containing the player license key and feature flags.
* @returns The modified Expo config object with Bitmovin Player configurations.
*
* @example
* // app.config.js
* module.exports = {
* plugins: [
* [
* 'bitmovin-player-react-native',
* {
* playerLicenseKey: 'YOUR_BITMOVIN_PLAYER_LICENSE_KEY',
* features: {
* airPlay: true,
* backgroundPlayback: true,
* googleCastSDK: { android: '21.3.0', ios: '4.8.1.2' },
* offline: true,
* pictureInPicture: true,
* },
* },
* ]
* ]
* };
*/
const withBitmovinConfig = (config, options) => {
const { playerLicenseKey, features } = options;
const mergedFeatures = { ...defaultFeatures, ...(features || {}) };
config = (0, withBitmovinIosConfig_1.default)(config, {
playerLicenseKey,
features: mergedFeatures,
});
config = (0, withBitmovinAndroidConfig_1.default)(config, {
playerLicenseKey,
features: mergedFeatures,
});
return config;
};
exports.default = withBitmovinConfig;