solid-software / flutter_vlc_player

📺 Flutter VLC powered video player.
500 stars 247 forks source link

RTSP Video Streaming not show correctly in iOS 17.0.1 #444

Open brothans opened 9 months ago

brothans commented 9 months ago

I used sample code as README.md and I modified part of it to play rtsp stream The rtsp streaming URL has been verified to play normally in the vlc player on the PC.

The code I modified is as follows:

 _videoPlayerController = VlcPlayerController.network(
   'rtsp://TEST_URL',
   hwAcc: HwAcc.full,
   autoPlay: true,
   options: VlcPlayerOptions(),
 );

When it running on an iPhone with iOS 16.6 or 16.7, flutter vlc player can display the rtsp streaming normally.

However, after iPhone is upgraded to iOS 17.0.1, when the same code is executed, flutter vlc player cannot display the rtsp streaming normally.

My environment: MabBook Air: macOS Ventura 13.6 Xcode: Version 15.0 Android Studio Electric Eel | 2022.1.1 Patch 2

Updated: I have tried the latest version flutter_vlc_player 7.4.0, it also have the same problem on iOS 17.0.1

Additionally, I also tried downloading the latest version of VLC media player v3.4.9 from the App Store. On iOS 17.0.1, the same rtsp stream plays fine.

Thank you in advance.

mzkaoq commented 8 months ago

hi, @brothans I have the same problem now, did you come up with any solutions?

alishe79 commented 7 months ago

same here

kostov commented 6 months ago

Same problem. MacOS Sonoma 14.2.1, Xcode: Version 15.1, iPhone 12, iOS 17.2. The bug appears on iOS 17+, doesn't appear on iOS 16-.

peter9teufel commented 5 months ago

got the same issue, android works, ios does not start the rtsp stream. Disabling local network permission is not possible as my app's main purpose is to communicate with a local device.

kostov commented 5 months ago

In the plugin code (flutter_vlc_player-7.4.1/ios/Classes/VlcViewController.swift) we can remove comments from these 2 lines:

//        self.vlcMediaPlayer.libraryInstance.debugLogging = true
//        self.vlcMediaPlayer.libraryInstance.debugLoggingLevel = 3

and will see more. Look at iOS17_failed.log After 2-3 minutes we can see first frame, in the log it corresponds:

...
[DBG] Buffering 42%
[DBG] Received first picture
[DBG] Buffering 45%
...

First error in the log coming just ~10 minutes ago:

[ERR] keep-alive failed: recvfrom() error: Connection reset by peer

So, vlc_player makes some work inside several minutes, not just failed and stop working. Look at this: image

Maybe someone has any idea what is happening? And where to dig on?

kostov commented 5 months ago

Everything is the same, only the iPhone is different (iPhone 10, iOS 16.6), all works fine, log: iOS16_works.log I think, the problem starts from these lines in iOS17_failed.log:

Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0
Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0
Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0
...

Googling leads to: https://code.videolan.org/videolan/VLCKit/-/issues/703 But still nothing is clear.

kostov commented 5 months ago

Preliminary investigation results: now 'com.apple.developer.networking.multicast' entitlement is required for VLC to work correctly with RTSP-streams. Additional links:

https://code.videolan.org/videolan/VLCKit/-/issues/628
https://code.videolan.org/videolan/vlc-ios/-/issues/1419
https://stackoverflow.com/questions/77396018/flutter-vlc-player-does-not-working-with-rtsp-streams-on-ios-17-0-17-0 (has reference to here :)

So, possible, we meet beautiful era where each project that uses flutter_vlc_player plugin for play RTSP-streams -- need to ask Apple INC for additional multicast permission. Will try to get it. To be continued...

MarkKh792 commented 4 months ago

Hi everyone, just got the entitlement for Multicast Networking. Ran my app on iPhone 14 (iOS 17.3.1) - everything works fine now.

So, you really need to ask for multicast permission to watch RTSP-streams on iOS.

MustafaGaber commented 3 months ago

I've already added the network multicast entitlement. The app worked fine for a long time. After the latest ios update, rtsp streams are no longer working for iOS.

thoranitnoy commented 3 months ago

Same here, please tell me how to add entitlement multicast networking in flutter project?

Gabriellsp commented 2 weeks ago

@MustafaGaber @thoranitnoy Did you happen to be able to solve this problem for iOS 17+? I added the multicast right, but I still have the problem...

Gabriellsp commented 2 weeks ago

@MarkKh792 Could you share with us how you added multicast? Because I added it here and the app still only works normally if we disable the local network. What vlc options are you using?

Gabriellsp commented 2 weeks ago

@thoranitnoy Were you able to configure VLC in Flutter to run with the local network enabled?

MustafaGaber commented 2 weeks ago

@MustafaGaber @thoranitnoy Did you happen to be able to solve this problem for iOS 17+? I added the multicast right, but I still have the problem...

I couldn't solve the problem, so I switched to use Media kit. It works with rtsp without any problems

MarkKh792 commented 2 weeks ago

@MarkKh792 Could you share with us how you added multicast? Because I added it here and the app still only works normally if we disable the local network. What vlc options are you using?

I added the Multicast Networking capability in Xcode. That's it. Now I use the media_kit package that has lower delay. These are my player options that I used: ':aspect-ratio=4:3', ':no-audio', ':rtsp-tcp', ':network-caching=100', ':clock-jitter=0', ':clock-synchro=1'

kostov commented 2 weeks ago

@MustafaGaber I couldn't solve the problem, so I switched to use Media kit. It works with rtsp without any problems

Mustafa, thank you very much: media_kit package is just amazing! Will use it instead of vlc.

Gabriellsp commented 2 weeks ago

@MarkKh792 Did the mediakit prove to be performant for you on both Android and iOS? In my tests, VLC's performance is much better than the Media Kit.

If so, could you share with us how the media_kit configuration went in your project to obtain high performance in RTSP streams?

MarkKh792 commented 1 week ago

@MarkKh792 Did the mediakit prove to be performant for you on both Android and iOS? In my tests, VLC's performance is much better than the Media Kit.

If so, could you share with us how the media_kit configuration went in your project to obtain high performance in RTSP streams?

I haven't encountered any serious performance issues while using media_kit. The only thing I noticed is that the stream takes a little longer to load on Android. Actually, I didn't have much time for testing because of the inconsistent access to the video stream.

I recommend to look for parameters here: https://github.com/media-kit/media-kit/issues/710 https://mpv.io/manual/master/#properties

Gabriellsp commented 1 week ago

The player slowdown issue was detected in versions 14.7 and 17.3. In versions 15.3, 15.4 and 15.6, the slowdown problem did not occur. Below you will find the logs collected from the different iOS versions. The problem only happens if the Local Network permission is enabled.

Logs_MobileVlcKit_iOS14.7-WithProblems.log Logs_MobileVlcKit_iOS15.4-NoProblems.log Logs_MobileVlcKit_ios17.3-WithProblems.log Logs_MobileVlcKit-iOS15.3-NoProblems.log Logs_MobileVlcKit-iOS15.6-NoProblems.log