Skip to content

Commit

Permalink
Merge branch 'development' into feature/base-enable-lock-screen-controls
Browse files Browse the repository at this point in the history
  • Loading branch information
123mpozzi authored Nov 7, 2024
2 parents 134e11e + 1b6f198 commit 97f7f89
Show file tree
Hide file tree
Showing 19 changed files with 266 additions and 83 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci-ios-tvos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ jobs:
restore-keys: pods-

- name: Install pods
run: |
pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git || pod repo update bitmovin
yarn pods
run: yarn pods
env:
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache

Expand Down Expand Up @@ -131,9 +129,7 @@ jobs:
restore-keys: pods-

- name: Install pods
run: |
pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git || pod repo update bitmovin
yarn example pods
run: yarn example pods
env:
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/create-sdk-update-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:
if: ${{ inputs.sdk_name == 'ios' }}
run: |
sed -i '' 's/s.dependency "BitmovinPlayer", ".*/s.dependency "BitmovinPlayer", "${{ inputs.version_number }}"/g' RNBitmovinPlayer.podspec
pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git
yarn bootstrap
- name: Save Pods cache
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/start-release-train.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ jobs:
run: |
yarn version --new-version ${{ inputs.version_number }} --no-git-tag-version
- name: Set up CocoaPods
run: |
pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git || pod repo update bitmovin
working-directory: example/ios
env:
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache

- name: Install pods to update Podfile.lock
run: |
yarn bootstrap
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [Unreleased]
## [0.30.0] - 2024-10-31

### Added

Expand All @@ -9,7 +9,16 @@

### Changed

- Update Bitmovin's native Android SDK version to `3.84.0`
- Update Bitmovin's native Android SDK version to `3.90.0`
- Update Bitmovin's native iOS SDK version to `3.77.0`

### Added

- `WebUiConfig.variant` to set the UI variant that should be used by the Bitmovin Web UI

### Fixed

- Spatial navigation in the Web UI does not work properly

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion RNBitmovinPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pod::Spec.new do |s|

s.swift_version = "5.10"
s.dependency "React-Core"
s.dependency "BitmovinPlayer", "3.74.0"
s.dependency "BitmovinPlayer", "3.77.0"
s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.23.0"
s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.13.0"
end
Original file line number Diff line number Diff line change
Expand Up @@ -752,18 +752,33 @@ fun ReadableMap.toPictureInPictureConfig(): PictureInPictureConfig = PictureInPi
isEnabled = getBooleanOrNull("isEnabled") ?: false,
)

/**
* Converts the [json] to a `RNUiConfig` object.
*/
fun toPlayerViewConfig(json: ReadableMap) = PlayerViewConfig(
uiConfig = UiConfig.WebUi(
playbackSpeedSelectionEnabled = json.getMap("uiConfig")
?.getBooleanOrNull("playbackSpeedSelectionEnabled")
?: true,
),
hideFirstFrame = json.getBooleanOrNull("hideFirstFrame") ?: false,
fun ReadableMap.toPlayerViewConfig(): PlayerViewConfig = PlayerViewConfig(
uiConfig = getMap("uiConfig")?.toUiConfig() ?: UiConfig.WebUi(),
hideFirstFrame = getBooleanOrNull("hideFirstFrame") ?: false,
)

private fun ReadableMap.toUiConfig(): UiConfig {
val variant = toVariant() ?: UiConfig.WebUi.Variant.SmallScreenUi
val focusUiOnInitialization = getBooleanOrNull("focusUiOnInitialization")
val defaultFocusUiOnInitialization = variant == UiConfig.WebUi.Variant.TvUi

return UiConfig.WebUi(
playbackSpeedSelectionEnabled = getBooleanOrNull("playbackSpeedSelectionEnabled") ?: true,
variant = variant,
focusUiOnInitialization = focusUiOnInitialization ?: defaultFocusUiOnInitialization,
)
}

private fun ReadableMap.toVariant(): UiConfig.WebUi.Variant? {
val uiManagerFactoryFunction = getMap("variant")?.getString("uiManagerFactoryFunction") ?: return null

return when (uiManagerFactoryFunction) {
"bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI" -> UiConfig.WebUi.Variant.SmallScreenUi
"bitmovin.playerui.UIFactory.buildDefaultTvUI" -> UiConfig.WebUi.Variant.TvUi
else -> UiConfig.WebUi.Variant.Custom(uiManagerFactoryFunction)
}
}

private fun ReadableMap.toUserInterfaceTypeFromPlayerConfig(): UserInterfaceType? =
when (getMap("styleConfig")?.getString("userInterfaceType")) {
"Subtitle" -> UserInterfaceType.Subtitle
Expand All @@ -775,7 +790,7 @@ private fun ReadableMap.toUserInterfaceTypeFromPlayerConfig(): UserInterfaceType
* Converts the [this@toRNPlayerViewConfigWrapper] to a `RNPlayerViewConfig` object.
*/
fun ReadableMap.toRNPlayerViewConfigWrapper() = RNPlayerViewConfigWrapper(
playerViewConfig = toPlayerViewConfig(this),
playerViewConfig = toPlayerViewConfig(),
pictureInPictureConfig = getMap("pictureInPictureConfig")?.toPictureInPictureConfig(),
)

Expand Down
1 change: 0 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

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

prepare_react_native_project!
Expand Down
31 changes: 15 additions & 16 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- BitmovinAnalyticsCollector/BitmovinPlayer (3.8.1):
- BitmovinAnalyticsCollector/BitmovinPlayer (3.9.0):
- BitmovinAnalyticsCollector/Core
- BitmovinPlayerCore (~> 3.48)
- BitmovinAnalyticsCollector/Core (3.8.1)
- BitmovinPlayer (3.74.0):
- BitmovinAnalyticsCollector/Core (3.9.0)
- BitmovinPlayer (3.77.0):
- BitmovinAnalyticsCollector/BitmovinPlayer (~> 3.0)
- BitmovinPlayerCore (= 3.74.0)
- BitmovinPlayerCore (3.74.0)
- BitmovinPlayerCore (= 3.77.0)
- BitmovinPlayerCore (3.77.0)
- boost (1.83.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.73.4-0)
Expand Down Expand Up @@ -1048,8 +1048,8 @@ PODS:
- React-jsi (= 0.73.4-0)
- React-logger (= 0.73.4-0)
- React-perflogger (= 0.73.4-0)
- RNBitmovinPlayer (0.29.0):
- BitmovinPlayer (= 3.74.0)
- RNBitmovinPlayer (0.30.0):
- BitmovinPlayer (= 3.77.0)
- GoogleAds-IMA-iOS-SDK (= 3.23.0)
- GoogleAds-IMA-tvOS-SDK (= 4.13.0)
- React-Core
Expand Down Expand Up @@ -1122,13 +1122,12 @@ DEPENDENCIES:
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
https://github.com/bitmovin/cocoapod-specs.git:
- BitmovinPlayer
- BitmovinPlayerCore
https://github.com/react-native-tvos/react-native-tvos-podspecs.git:
- libevent
trunk:
- BitmovinAnalyticsCollector
- BitmovinPlayer
- BitmovinPlayerCore
- google-cast-sdk
- GoogleAds-IMA-iOS-SDK
- GoogleAds-IMA-tvOS-SDK
Expand Down Expand Up @@ -1245,9 +1244,9 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
BitmovinAnalyticsCollector: 972e52381ef61210fbf9397e5fbf22db462ac94a
BitmovinPlayer: 4a7f76d0d904f61ed66adde34741e051a5b955ef
BitmovinPlayerCore: d171e1f6b9d64a2eb2cc9c168d6bdcf00af313e4
BitmovinAnalyticsCollector: d08e0b13bcc32973370e0d71f2faa739561bac0a
BitmovinPlayer: 65866e13f7a8246ccbc7378607d6ca789f0f459e
BitmovinPlayerCore: 158b4a5b81b12b819f0f51b7b89711ca47e11583
boost: 88202336c3ba1e7a264a83c0c888784b0f360c28
DoubleConversion: 74cb0ce4de271b23e772567504735c87134edf0a
FBLazyVector: 33a271a7e8de0bd321e47356d8bc3b2d5fb9ddba
Expand Down Expand Up @@ -1302,12 +1301,12 @@ SPEC CHECKSUMS:
React-runtimescheduler: 20b2202e3396589a71069d12ae9f328949c7c7b8
React-utils: 0307d396f233e47a167b5aaf045b0e4e1dc19d74
ReactCommon: 17891ca337bfa5a7263649b09f27a8c664537bf2
RNBitmovinPlayer: 2f8aa7c280fe632550dcb872738610632d87440f
RNBitmovinPlayer: 5df76edfd71a5887aa20210108bdf9ac7227048b
RNCPicker: b18aaf30df596e9b1738e7c1f9ee55402a229dca
RNScreens: b582cb834dc4133307562e930e8fa914b8c04ef2
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: ab50eb8f7fcf1b36aad1801b5687b66b2c0aa000
Yoga: e7f2a2256464d4ef7b3825d216bd22aac3b449c1

PODFILE CHECKSUM: e89ebfe6215567e7e15880586d123e5ea122588c
PODFILE CHECKSUM: 11ac6cb62c1978622f6d687b574d9de3441a2680

COCOAPODS: 1.15.2
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"ios": "react-native run-ios",
"start": "react-native start",
"pods": "yarn pods-install || yarn pods-update",
"pods-install": "NO_FLIPPER=1 yarn pod-install",
"pods-update": "cd ios && NO_FLIPPER=1 pod update --silent"
"pods-install": "[ \"$(uname)\" != Darwin ] || NO_FLIPPER=1 yarn pod-install",
"pods-update": "[ \"$(uname)\" != Darwin ] || cd ios && NO_FLIPPER=1 pod update --silent"
},
"dependencies": {
"@react-native-picker/picker": "2.6.1",
Expand Down
17 changes: 17 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ExamplesList from './screens/ExamplesList';
import BasicAds from './screens/BasicAds';
import BasicAnalytics from './screens/BasicAnalytics';
import BasicPlayback from './screens/BasicPlayback';
import BasicTvPlayback from './screens/BasicTvPlayback';
import BasicDrmPlayback from './screens/BasicDrmPlayback';
import SubtitlePlayback from './screens/SubtitlePlayback';
import ProgrammaticTrackSelection from './screens/ProgrammaticTrackSelection';
Expand All @@ -32,6 +33,7 @@ export type RootStackParamsList = {
BasicAds: undefined;
BasicAnalytics: undefined;
BasicPlayback: undefined;
BasicTvPlayback: undefined;
BasicDrmPlayback: undefined;
BasicPictureInPicture: {
navigation: NativeStackNavigationProp<RootStackParamsList>;
Expand Down Expand Up @@ -65,6 +67,7 @@ export type RootStackParamsList = {
const RootStack = createNativeStackNavigator<RootStackParamsList>();

const isTVOS = Platform.OS === 'ios' && Platform.isTV;
const isAndroidTV = Platform.OS === 'android' && Platform.isTV;

export default function App() {
useEffect(() => {
Expand Down Expand Up @@ -118,6 +121,13 @@ export default function App() {
],
};

if (isAndroidTV) {
stackParams.data.unshift({
title: 'Basic TV playback',
routeName: 'BasicTvPlayback',
});
}

if (!isTVOS) {
stackParams.data.push({
title: 'Custom HTML UI',
Expand Down Expand Up @@ -192,6 +202,13 @@ export default function App() {
component={BasicPlayback}
options={{ title: 'Basic playback' }}
/>
{isAndroidTV && (
<RootStack.Screen
name="BasicTvPlayback"
component={BasicTvPlayback}
options={{ title: 'Basic TV playback' }}
/>
)}
<RootStack.Screen
name="BasicDrmPlayback"
component={BasicDrmPlayback}
Expand Down
94 changes: 94 additions & 0 deletions example/src/screens/BasicTvPlayback.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, { useCallback } from 'react';
import { View, Platform, StyleSheet } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';
import {
Event,
usePlayer,
PlayerView,
SourceType,
PlayerViewConfig,
TvUi,
} from 'bitmovin-player-react-native';
import { useTVGestures } from '../hooks';

function prettyPrint(header: string, obj: any) {
console.log(header, JSON.stringify(obj, null, 2));
}

export default function BasicTvPlayback() {
useTVGestures();

const player = usePlayer({
remoteControlConfig: {
isCastEnabled: false,
},
});

const config: PlayerViewConfig = {
uiConfig: {
// This is only applied for Android TVs, as on TvOS only the system UI is supported.
variant: new TvUi(),
},
};

useFocusEffect(
useCallback(() => {
player.load({
url:
Platform.OS === 'ios'
? 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8'
: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
type: Platform.OS === 'ios' ? SourceType.HLS : SourceType.DASH,
title: 'Art of Motion',
poster:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/poster.jpg',
thumbnailTrack:
'https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/thumbnails/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.vtt',
metadata: { platform: Platform.OS },
});
return () => {
player.destroy();
};
}, [player])
);

const onReady = useCallback((event: Event) => {
prettyPrint(`EVENT [${event.name}]`, event);
}, []);

const onEvent = useCallback((event: Event) => {
prettyPrint(`EVENT [${event.name}]`, event);
}, []);

return (
<View style={styles.container}>
<PlayerView
player={player}
style={styles.player}
config={config}
onPlay={onEvent}
onPlaying={onEvent}
onPaused={onEvent}
onReady={onReady}
onSourceLoaded={onEvent}
onSeek={onEvent}
onSeeked={onEvent}
onStallStarted={onEvent}
onStallEnded={onEvent}
onVideoPlaybackQualityChanged={onEvent}
/>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'black',
},
player: {
flex: 1,
},
});
Loading

0 comments on commit 97f7f89

Please sign in to comment.