kakone / VLC.MediaElement

MediaElement clone powered by VLC
GNU Lesser General Public License v2.1
68 stars 33 forks source link

Using ShowLoginDialog #73

Closed arc95 closed 6 years ago

arc95 commented 6 years ago

Hi @kakone, I need to pass credentials to the video stream that's being opened. I saw this issue, where it talks about listening to ShowLoginDialog and subscribing to it. I'm looking at the sample app and wondering where I would do this. Can you provide an example code of how to do this? Thanks.

nograx commented 6 years ago

It's easy:

public void MediaElement_ShowLoginDialog(object sender, VLC.LoginDialogEventArgs e) { e.DialogResult = new VLC.LoginDialogResult(); e.DialogResult.Username = "username"; e.DialogResult.Password = "password"; e.DialogResult.StoreCredentials = true; }

You can also use a Dialog box and get Inputs from there.

arc95 commented 6 years ago

Thanks, @nograx. Sorry for my beginner question, but is it possible in that handler to prevent the dialog from appearing to the user so we just give the video the necessary credentials seamlessly? Thanks 👍

nograx commented 6 years ago

The Event is called "ShowLoginDialog", but no dialog will be shown at all. Just use the code above and provide your credentials with Username and Password.