Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][IOS] When multiple audio tracks are provided default audio track is not working #64

Open
fdobre opened this issue Jul 24, 2024 · 2 comments
Labels
in-progress Actively being worked on by the asignee native-sdk-issue Work is blocked by native SDK

Comments

@fdobre
Copy link

fdobre commented Jul 24, 2024

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

  1. Use a video that has at least 2 audio tracks.
  2. Play the video.
  3. Observe there is no sound even if the default track is active in the audio tracks menu
  4. Switch to another audio track
  5. Observe it has sound
  6. Switch back to the default track
  7. 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 fdobre added the needs-grooming Has not been reviewed by codeowners for scope/validation label Jul 24, 2024
@AmitaiB AmitaiB added the needs-info There isn't enough information. Please add more context label Jul 24, 2024
@AmitaiB
Copy link
Contributor

AmitaiB commented Jul 24, 2024

@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.

@fdobre
Copy link
Author

fdobre commented Jul 29, 2024

@AmitaiB

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.

@Jmilham21 Jmilham21 added in-progress Actively being worked on by the asignee native-sdk-issue Work is blocked by native SDK and removed needs-grooming Has not been reviewed by codeowners for scope/validation needs-info There isn't enough information. Please add more context labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress Actively being worked on by the asignee native-sdk-issue Work is blocked by native SDK
Projects
None yet
Development

No branches or pull requests

3 participants