TheWidlarzGroup / react-native-video

A <Video /> component for react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE]: iOS notification controls lack functionality related to the progress bar with live playback

paulrinaldi opened this issue · comments

Version

6.2.0

What platforms are you having the problem on?

iOS

System Version

15, 16, 17.5

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

When viewing notification controls on iOS with a live stream, the following do not display:

  • Duration/time elapsed
  • Progress bar activity
  • Circular scrub button

whereas on Android they do.

Observed on real devices (1 physical device on 17.5, 2 devices on Browserstack).

Reproduction

No response

Reproduction

Step to reproduce this bug are:

  1. Ensure props are set
<Video
  source={ uri: 'https://democracynow-hls.secdn.net/democracynow-live/play/democracynow.smil/playlist.m3u8' }
  showNotificationControls={true}
  playInBackground={true}
  />
  1. Ensure background audio is enabled in XCode (UIBackgroundModes: ["audio"] in Expo)
  2. Generate an iOS build
  3. Run the iOS build on a physical device
  4. Play the video player
  5. Background the app
  6. Scroll down from the top of the screen to see the notification controls
  7. Observe the lack of the duration, progress bar activity, and the progress bar scrub button

e.g.

Screenshot 2024-06-12 at 10 56 18 AM

iOS Live Control Notif Downward

From looking at released apps such as CNN, NBC, and Radio on the Apple App Store and what is available in the documentation, it seems the best we can do on iOS is get the control notification banner to say "LIVE" instead of just he weird -- on both sides. This patch is what I think is required and other suggest on the web (although from 2018):

However, after making this change on 6.2.0, I still see the same functionality what is above.

class NowPlayingInfoCenterManager {
    static let shared = NowPlayingInfoCenterManager()
    ...
    public func updateMetadata() {
        ...
        nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true // todo: add if statement so we only do it on livestreams
    }
}

I also was struggling to figure out the best way to determine when to set the nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true since we should not set when the item being played is not a livestream.

Unfortunately, this can't be tested on a simulator since Apple doesn't show notifications on simulators so debugging what is going wrong is further complicated.

Looking for help/suggestions.

Goal (right side):
image

@paulrinaldi did you see: mpnowplayinginfopropertyplaybackprogress ? moreover the 'timings' are not peridicly refreshed, It also think it should be an issue ...

maybe you can also try to enable: https://developer.apple.com/documentation/mediaplayer/mpnowplayingsession/4076567-automaticallypublishesnowplaying just to see if time is coming

I don't think live is the good clue, even if it make sens to enable its usage

Playbackprogress doesn't look too helpful in this case. Unfortunately, apple notes that "If you create an MPNowPlayingSession object, don’t attempt to use it with the AVPlayer that an AVPlayerViewController presents." (source and so it is taking more effort in trying to even test this. Also MPNowPlayingSession is only available in iOS 16+ it seems.

Still, it is so weird that setting live doesn't work correctly. I may try the basic example.

I got live to work with that key being set in the example/basic, should be able to add a detection mechanism and then send a fix