[BUG][IOS] When multiple audio tracks are provided default audio track is not working
fdobre opened this issue · 2 comments
Describe the bug
"@jwplayer/jwplayer-react-native": "^1.0.1",
"react-native": "0.72.14"
When providing multiple audio tracks video has absolutely no sound.
After switching to another track sound works but switching back to the default track triggers an 1008 error.
Multiple audio tracks support doesn't have the above issue in Android.
To Reproduce
- Use a video that has at least 2 audio tracks.
- Play the video.
- Observe there is no sound even if the default track is active in the audio tracks menu
- Switch to another audio track
- Observe it has sound
- Switch back to the default track
- There is some loader showing and after that a 1008 error.
Expected behavior
Audio tracks should work as in Android. Default audio track should have sound and when switching back to the default audio track there should be no error and sound should work.
@fdobre Hey, thank you for reporting this issue. Can you share your player configuration/setup implementation? This can happen if no audio track is designated the default.
const memoizedTracks = useMemo<Track[]>(() => {
const tracks: Track[] = (captions || [])?.map(item => {
return {
file: item?.file ?? '',
label: item?.label ?? '',
kind: 'captions',
default:
(item?.languageCode || '').toLowerCase() === languageCode
? true
: isAndroid
? false
: undefined
};
});
if (thumbnailPreviews) {
tracks.push({
file: thumbnailPreviews,
kind: 'thumbnails',
label: 'thumbnails'
});
}
return tracks;
}, [languageCode, captions, thumbnailPreviews]);
const playlistItem = useMemo(
() => ({
image,
file: hlsUrl,
tracks: memoizedTracks ?? []
}),
[hlsUrl, image, memoizedTracks]
);
const jwConfig: Config = useMemo(
() => ({
license: isIOS
? config.jwPlayerIOSLicense
: config.jwPlayerAndroidLicense,
enableLockScreenControls: false, // iOS only
// Having PiP enabled on Android triggers a crash if advertisments (pre-rolls) are also enabled, retest this after JWP update
pipEnabled: isIOS,
backgroundAudioEnabled: false,
autostart: true,
playlist: [playlistItem],
styling: {
menuStyle: {
backgroundColour: 'rgba(51, 51, 51, 1)',
fontColor: 'rgba(255, 255, 255, 0.8)'
},
colours: {
timeslider: {
progress: '#ff1541',
rail: 'rgba(255, 255, 255, 0.3)'
}
}
},
advertising: isPremium
? undefined
: {
adClient: 'vast',
adSchedule: [{ offset: 'pre', tag: vastTag }]
},
landscapeOnFullScreen: true,
fullScreenOnLandscape: isAndroid,
portraitOnExitFullScreen: true, // Supported for Android only
exitFullScreenOnPortrait: isAndroid,
hideUiGroups: ['casting_menu'],
hideCastIcon: isAndroid ? true : undefined // We had to add a patch in RN-JWPlayer to hide the cast button
}),
[playlistItem, isPremium, vastTag]
);
Hope this helps. If any other additional info is needed please let me know.