flutter_vlc_player icon indicating copy to clipboard operation
flutter_vlc_player copied to clipboard

RTSP Video Streaming not show correctly in iOS 17.0.1

Open brothans opened this issue 11 months ago • 17 comments

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.

brothans avatar Sep 26 '23 11:09 brothans

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

mzkaoq avatar Oct 27 '23 22:10 mzkaoq

same here

alishe79 avatar Dec 05 '23 14:12 alishe79

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

kostov avatar Jan 19 '24 08:01 kostov

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.

peter9teufel avatar Jan 21 '24 12:01 peter9teufel

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 avatar Jan 22 '24 05:01 kostov

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 avatar Jan 22 '24 06:01 kostov

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

kostov avatar Jan 24 '24 05:01 kostov

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.

MarkKh792 avatar Mar 06 '24 09:03 MarkKh792

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.

MustafaGaber avatar Apr 04 '24 15:04 MustafaGaber

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

thoranitnoy avatar Apr 09 '24 08:04 thoranitnoy

@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 avatar Jun 29 '24 13:06 Gabriellsp

@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 avatar Jun 29 '24 13:06 Gabriellsp

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

Gabriellsp avatar Jun 29 '24 13:06 Gabriellsp

@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

MustafaGaber avatar Jun 29 '24 21:06 MustafaGaber

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

MarkKh792 avatar Jul 01 '24 08:07 MarkKh792

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

kostov avatar Jul 01 '24 09:07 kostov

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

Gabriellsp avatar Jul 01 '24 11:07 Gabriellsp

@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

MarkKh792 avatar Jul 05 '24 09:07 MarkKh792

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

Gabriellsp avatar Jul 05 '24 14:07 Gabriellsp