Closed TheOriginalAppStar closed 7 years ago
Turns out I can connect to an RTSP live stream. What doesn't work is connecting to an RTSP stream that requires authentication. I've tried inserting credentials into the url via this convention: rtsp://[Username]:[Password]@[IP]:[Port], but it still doesn't work. (FYI, the log says this convention is deprecated). How can I provide my credentials to the stream?
With VLC command line (https://wiki.videolan.org/VLC_command-line_help/), we can add these credentials with rtsp-user and rtsp-pwd options. I just created an Options property on the MediaElement to add options to the media. You must define this property before setting the source. Try to add rtsp-user and rtsp-pwd to this options dictionary, perhaps it will works.
Thanks for the quick reply! Unfortunately adding the user and pwd options didn't work. I even set the dialog handlers on the Instance but ShowLoginDialog is never invoked. It's strange that it works in the VLC Universal app but not here. I attached a debugger to the VLC Universal app and you can clearly see live555 returns "authentication failed". However, it then attempts to authenticate with my user and successfully opens the stream. My app never does that; instead live555 returns "connection error -10057" and vlc attempts some alternative methods which also fail. None of them seem to try and authenticate. Is it possible there is a missing configuration or even libVLCX is out of date?
Attached are the logs of both apps: Non-working MediaElement log.txt Working VLC Universal app log.txt
Follow-up: I just saw you updated libVLCX nuget package and added the keystore setting so that must not be it either.
If it works in the VLC Universal app, we must be able to make it work. In the VLC Universal app, it displays a login dialog box ?
It works both ways as expected in the VLC UWP App.
I've tried both ways in the MediaElement app. I'm trying to understand why the logs are different for live555. Why does the same url return "connection error -10057" on my app, but VLC App returns "authentication failed" and then automatically attempts to authenticate?
Very strange, I don't know what's missing. I'm browsing the source code of the VLC app to find the difference.
I pulled down the VLC Universal app source to rule out the possibility of some strange build issue on my machine causing the problem. The local build VLC app ran just like the one downloaded from the store and played the stream properly. (Btw, I really appreciate the simplicity of your libVLC nuget package even more so after going though the build process).
This is a long shot... I noticed VLC is using async and await to make sure the player Instance is ready before attempting to play any media. Now that the KeyStore file was added to init; is it possible the keystore isn't fully loaded before playing the stream and therefore VLC is skipping authentication logic?
Found the issue! VLC requires the "privateNetworkClientServer" Capability in the app manifest for authentication to work. I also added the "backgroundMediaPlayback" capability for good measure. Thanks for your help and putting this project out there!
Great ! I think it's RTSP that requires privateNetworkClientServer capability because HTTP authentication works great without it. I'm adding some events to manage the login dialog event.
In version 0.9.10, you can now use rtsp://user:pass@xyz directly.
The UWP VLC app in the windows store supports RTSP. Does the VLC.MediaElement support RTSP? I can't connect to an RTSP url.