| View previous topic :: View next topic |
| Author |
Message |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 1:57 pm Post subject: Listener Authentication |
|
|
Hi All,
I am wondering if it is possible to add the username and password to the URL upon connecting to an IceCast server?
For Example:
http://UserName:Password@x.x.x.x:xxxx/mount
or
http://x.x.x.x:xxxx/mount?user=UserName&pass=Password
or something similar.
What I am hoping to do, is to have a portal where members sign up, and have IceCast configured for URL authentication, which will check with a PHP Script for information, but I would like the user to not have to put in the username and password each time, but have the PHP Script put this in based on who is logged in to the portal.
I have a basic flash player, and I would like the flash player to basically automatically authenticate based on who is logged in.
Any help will be greatly aprpeciated!
Thanks,
ChildOTK |
|
| Back to top |
|
 |
audiorapture
Joined: 21 Aug 2009 Posts: 60 Location: Virginia, USA
|
Posted: Thu Sep 03, 2009 3:16 pm Post subject: |
|
|
It should work, as that is what should happen if a user logs in through the Icecast-supplied authentication page.
You can easily test this by generating a M3U file containing the URL in http://user:pass@server/mount format.
Cheers,
-AR- |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Sep 03, 2009 3:20 pm Post subject: |
|
|
Have your portal generate an m3u with those details in, either format will suffice as far as icecast is concerned. When the listener add is issued, you'll either get the user/pass separated in the POST or embedded in the mount depending which you decide on.
karl. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 5:50 pm Post subject: |
|
|
Thank you for replies.
@AR: I have tried hardcoding the URL into the flash movie, setting the URL on the http://username:password@host:port/mount method, but it does not work. It keeps timing out.
If I try the other way: http://host:port/mount?user=user&pass=pass it fails immediately.
@karl: How would I use m3u? I have never worked with m3u before to be honest. I tried using the log in through the admin page, using the buildm3u feature, but this immediately opened up my winamp to play the stream.
Is there a way to make this work for the flash player?
Thanks for your help guys. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 6:05 pm Post subject: |
|
|
Okay, I have solved my problem.
I added some code in the flash file to open the path to the mount and login, and then attempt to open the stream.
So I have this up at the top of my flash file to login for the user:
var loadvars = new LoadVars();
var str = Base64.Encode("username:password");
loadvars.addRequestHeader("Authorization:", "Basic "+str);
loadvars.load("http://host:port/mount"); |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 6:11 pm Post subject: |
|
|
Ummm...or not...
I tried it in Internet Explorer, and it asked me still for the login...I guess I must have logged in already in Firefox...so never mind...that doesn't work...lol |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Sep 03, 2009 6:32 pm Post subject: |
|
|
I mentioned m3u as an example, any playlist format should suffice as long as it generates the stream url required to pass the auth to icecast. If the listener is still being rejected then the listener_add script is doing that.
karl. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 6:34 pm Post subject: |
|
|
Okay.
Well, the listener_add script it working fine. I can type in my username and password in the popup box and the stream works just fine. So that part is working.
I just do not know how I should go about doing what you say. I am a newbie to flash. |
|
| Back to top |
|
 |
audiorapture
Joined: 21 Aug 2009 Posts: 60 Location: Virginia, USA
|
Posted: Thu Sep 03, 2009 6:46 pm Post subject: |
|
|
An M3U file is a simple text file. It simply contains the URL for the stream.
As a test, create a text file with a .m3u extension. Enter the URL (with authentication) for the stream and save the m3u file.
Open the file in pretty much any software MP3 player and the stream should play without prompting for authentication.
If that works, you have to troubleshoot your flash player. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 6:48 pm Post subject: |
|
|
Okay,
Yeah, that does work just fine.
I used IceCasts admin portal to generate a m3u file earlier, and this immediately opened up my winamp and the stream started playing with no problem.
I know the problem is with the flash player, but I just am not sure how to go about solving the problem at hand. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Sep 03, 2009 7:08 pm Post subject: |
|
|
flash has traditionally made for a poor player, maybe the notion of user/pass authentication is too advanced for it. You can check the headers that are sent to icecast with a packet sniffer to see what it actually sends or you could try the query arg approach instead.
karl. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 7:25 pm Post subject: |
|
|
Is there anything you can recommend then?
IceCast appears to only work with Winamp. I have tried iTunes and WMP and they both are unable to play the stream.
My main issue is the authentication. I would like them to login to the portal, and the portal automatically log them in to the stream. So I keep it a members only type of thing, but without them having to login twice.
If I use the http://username:password...method, the flash player just sits there in trying to open the URL. And I do not know why. So maybe if there is some alternative that I could look in to, I would like to know about it. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Sep 03, 2009 7:58 pm Post subject: |
|
|
so those players request the stream but pass no authentication?
karl. |
|
| Back to top |
|
 |
ChildOTK
Joined: 02 Sep 2009 Posts: 30
|
Posted: Thu Sep 03, 2009 8:03 pm Post subject: |
|
|
| It appears so. Another flash player I try sits on 'Buffering' but doesnt do anything further. |
|
| Back to top |
|
 |
audiorapture
Joined: 21 Aug 2009 Posts: 60 Location: Virginia, USA
|
Posted: Thu Sep 03, 2009 8:09 pm Post subject: |
|
|
| ChildOTK wrote: |
| IceCast appears to only work with Winamp. I have tried iTunes and WMP and they both are unable to play the stream. |
I have no problems with iTunes, WMP, or VLC. Even for authenticated streams. They all ask for the password and stream properly. |
|
| Back to top |
|
 |
|