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

Turn on nativeTextTracks only for browsers using native iOS player #744

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/components/MediaPlayer/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { playerHotKeys } from '@Services/utility-helpers';
import { useManifestState } from '../../context/manifest-context';
import { usePlayerState } from '../../context/player-context';
import { useErrorBoundary } from "react-error-boundary";
import { IS_ANDROID, IS_MOBILE, IS_SAFARI, IS_TOUCH_ONLY } from '@Services/browser';
import { IS_ANDROID, IS_IPAD, IS_IPHONE, IS_MOBILE, IS_SAFARI, IS_TOUCH_ONLY } from '@Services/browser';
import { useMediaPlayer, useSetupPlayer } from '@Services/ramp-hooks';

// Default language for Video.js
Expand Down Expand Up @@ -94,9 +94,15 @@ const MediaPlayer = ({
// user is always active. And the control bar is not hidden when user is active.
// With this user can always use the controls when the media is playing.
inactivityTimeout: (IS_MOBILE || IS_TOUCH_ONLY) ? 0 : 2000,
// Enable native text track functionality in iPhones and iPads
// In iOS devices the player uses native iOS player either by default or on fullscreen-mode.
// For instance where iOS player is used for playback, native text track functionality
// needs to be turned ON for captions to work properly between VideoJS player and
// iOS player.
// Therefore, turn on 'nativeTextTracks' option for browser and OS combinations
// where the native iOS player is used by default or on fullscreen-mode.
// i.e. Both Safari and Chrome on iPhones, only Chrome on iPads.
html5: {
nativeTextTracks: IS_MOBILE && !IS_ANDROID
nativeTextTracks: !IS_ANDROID && ((IS_IPAD && !IS_SAFARI) || IS_IPHONE)
},
// Make error display modal dismissable
errorDisplay: {
Expand Down