Skip to content

Commit

Permalink
Merge branch 'development' into PRN-66/update-react-native-to-the-lat…
Browse files Browse the repository at this point in the history
…est-version
  • Loading branch information
zigavehovec committed Dec 1, 2023
2 parents cfed18c + 75a40c4 commit 807a221
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- iOS: `onEvent` on iOS has incomplete payload information
- tvOS: Picture in Picture sample screen has unwanted padding
- iOS: hide home indicator when entering fullscreen mode in the example application
- iOS: invalid `loadingState` value in `SeekEvent`, `SourceLoadEvent`, `SourceLoadedEvent` and in `SourceUnloadedEvent`

## [0.14.1] (2023-11-16)

Expand Down
18 changes: 16 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Platform, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { SourceType } from 'bitmovin-player-react-native';
import { AudioSession, SourceType } from 'bitmovin-player-react-native';
import ExamplesList from './screens/ExamplesList';
import BasicAds from './screens/BasicAds';
import BasicAnalytics from './screens/BasicAnalytics';
Expand Down Expand Up @@ -63,6 +63,20 @@ const RootStack = createNativeStackNavigator();
const isTVOS = Platform.OS === 'ios' && Platform.isTV;

export default function App() {
useEffect(() => {
// iOS audio session category must be set to `playback` first, otherwise playback
// will have no audio when the device is silenced.
// This is also required to make Picture in Picture work on iOS.
//
// Usually it's desireable to set the audio's category only once during your app's main component
// initialization. This way you can guarantee that your app's audio category is properly
// configured throughout the whole lifecycle of the application.
AudioSession.setCategory('playback').catch((error) => {
// Handle any native errors that might occur while setting the audio's category.
console.log("Failed to set app's audio category to `playback`:\n", error);
});
});

const stackParams = {
data: [
{
Expand Down
14 changes: 0 additions & 14 deletions example/src/screens/BasicPictureInPicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
usePlayer,
PlayerView,
SourceType,
AudioSession,
PictureInPictureEnterEvent,
PictureInPictureExitEvent,
PlayerViewConfig,
Expand Down Expand Up @@ -51,19 +50,6 @@ export default function BasicPictureInPicture({

useFocusEffect(
useCallback(() => {
// iOS audio session must be set to `playback` first otherwise PiP mode won't work.
//
// Usually it's desireable to set the audio's category only once during your app's main component
// initialization. This way you can guarantee that your app's audio category is properly
// configured throughout the whole lifecycle of the application.
AudioSession.setCategory('playback').catch((error) => {
// Handle any native errors that might occur while setting the audio's category.
console.log(
"[BasicPictureInPicture] Failed to set app's audio category to `playback`:\n",
error
);
});

// Load desired source configuration
player.load({
url:
Expand Down
2 changes: 1 addition & 1 deletion ios/Event+JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension Source {
var json: [AnyHashable: Any] = [
"duration": duration,
"isActive": isActive,
"loadingState": loadingState,
"loadingState": loadingState.rawValue,
"isAttachedToPlayer": isAttachedToPlayer
]
if let metadata {
Expand Down
5 changes: 5 additions & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { SubtitleTrack } from './subtitleTrack';
import { VideoQuality } from './media';
import { AudioTrack } from './audioTrack';
import { LoadingState } from './source';

/**
* Base event type for all events.
Expand Down Expand Up @@ -139,6 +140,10 @@ export interface EventSource {
* Metadata for this event's source.
*/
metadata?: Record<string, any>;
/**
* The current `LoadingState` of the source.
*/
loadingState: LoadingState;
}

/**
Expand Down

0 comments on commit 807a221

Please sign in to comment.