icecast and mixxx setup - clients cannot hear my radio station - javascript

I just finished setting up icecast2 server and mixxx in my computer. I can listen to my radio through the url: http://127.0.0.1:8000/soylatino. However, I asked my friends in another states if they can listen to my radio and they said that they cannot listen anything, but a message of Error #2032 came up after they hit play button. They also have adobe flash player working in their computers. Can someone please tell me if I am doing something wrong by trying to configure my server or maybe something else is wrong?
Thanks a lot in advance for your support.
I am using the following xml parameters in icecast.xml file:
<!-- You may have multiple <listener> elements -->
<listen-socket>
<port>8000</port>
<!-- <bind-address>127.0.0.1</bind-address> -->
<!-- <shoutcast-mount>/stream</shoutcast-mount> -->
</listen-socket>
<!--
<relay>
<server>127.0.0.1</server>
<port>8080</port>
<mount>/soylatino</mount>
<local-mount>/different.ogg</local-mount>
<relay-shoutcast-metadata>0</relay-shoutcast-metadata>
</relay>
-->
In mixxx live broadcasting settings, I am using the following settings:
Type: icecast2,
Host: 127.0.0.1,
Port: 8000,
Mount: /soylatino,
Login: source,
Password: mypassword,
Then, when I hit OK button, a message appears:
Mixx has successfully connected to the streaming server.
Next: I wrote the following code in my html page:
<div id="container">Get the Flash Player to see this player.
<script type="text/javascript" src="http://www.shoutcheap.com/flashplayer/skins/swfobject.js"></script>
<script type='text/javascript'>
var s1 = new SWFObject('http://www.shoutcheap.com/flashplayer/skins/player.swf','player',"340","50","9","#FFFFFF");
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always') s1.addParam("flashvars","skin=http://www.shoutcheap.com/flashplayer/skins/grungetape.swf&title=Live Stream&type=sound&file=http://127.0.0.1:8000/soylatino%3Ftype%3D.mp3 &13202692901&duration=99999&id=scplayer&autostart=true");
s1.write("container");
This is my page: www.followperu.com/radio.html

127.0.0.1 is a special IP address used for loopback. That is, 127.0.0.1 always means yourself... your own computer.
You can connect to 127.0.0.1 because you're running the server on the same computer as Mixxx. However, when your friends try to connect to 127.0.0.1, their browser tries to connect to their own computers, not yours.
While you can use 127.0.0.1, you need to give your friends your public IP address. In most home network setups, you only have one public IP address which your router handles. Your router then assigns private IP addresses to other computers on your network, and handles routing requests between the two networks via NAT. If you Google for, "what is my IP address?", it will give you your public IP address. (You can also get this information in your router's configuration.) Next, make sure you have forwarded over port 8000 from your router to your computer's private IP address. (This private IP address is not the loopback 127.0.0.1. It will be in one of the private network blocks, such as 10.0.0.0 or 192.168.0.0 or 172.16.0.0.)

Related

Licode: Publishing Stream has failed after successful ICE checks

I'm following the guide on Licode page
I have installed everything on Ubuntu 14.04.
I have configure ssl for licode and erizo controller in licode_config.js file to make the example works. Every other configurations i just keep them un-touch.
I have run the basic example but i cannot make a video conference.
Tracing google chrome console log, i catched:
WARNING: Publishing Stream 665544631310986500 has failed after successful ICE checks
DEBUG: Event: stream-failed
Stream Failed, act accordingly
DEBUG: Received a removeStream for 665544631310986500 and it has not been registered here, ignoring.
INFO: Stream unpublished
It's looks like i have to configure STUN or something in configuration of licode to make it works.
Got to say "Thank you!", it works for me by setting following in licode_config.js
set the range of ports to be used by libnice:
config.erizo.minport=30000
config.erizo.maxport=31000
set server public IP
config.erizoController.publicIP=serverPublicIP
config.erizoAgent.publicIP=serverPublicIP
Change default stun server as stun.google is wall'ed in countries like north korea, Iran etc.
My licode runs in docker, having ports mapping from server to the docker container of range 30000-31000, so have to ensure libnice ports fall into the range.
After reading several articles on Licode website and their community. I find out that, the issue just because my server is an Azure VPS - not a local computer. It has public IP and private IP so I have to set config.erizoController.publicIP, config.erizoAgent.publicIP to the public IP of the server.
Also Azure vps close all ports by default (except some ports i have already opened). Because of that, i have to open suitable port range and setting the config.erizo.minport, config.erizo.maxport in licode_config.js file. The port range i use: 30000-31000.
The valuable reference: http://discourse.lynckia.com/t/running-licode-in-azure/29

Websockets Address on Internal Network need's static ip?

I'm running a Go webserver using Gorilla/websocket for a real-time chess/chat application. As far as I know, I define the address and port in two locations, the Go http.ListenAndServer() method and the Javascript new Websocket(); function. This works great accross browsers on the same host machine, but it gets tricky when trying to extend the functionality over my internal network. So I use, for instance:
Go:
PORT := "0.0.0.0:8080"
// ...
http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
h.serveWs(hub, w, r) // h is a chessboard Handler wrapper
})
//...
http.ListenAndServe(PORT, nil)
Javascript:
conn = new WebSocket("ws://0.0.0.0:8080/ws");
In my effort to get this working on different devices over the network I've tried using, instead of the 0.0.0.0 address, localhost or my hostname and my host's internal ip (e.g.) 10.232.44.20; With the latter, the internal ip hardcoded in, it works, but the other attempts don't. I thought that using 0.0.0.0 would accept all connections from within the network, which I gathered from this answer:
What is the difference between 0.0.0.0, 127.0.0.1 and localhost?
How should I program ListenAndServe as well as new Websocket so that I can access the server within the internal network, without having to hardcode my internal ip address? Should I access that number programmatically from Js and Go? In the end, I want to be able to run this server on a variety of networks, without configuration, and have it just work. What am I missing?
If the web page and websocket endpoints are served by the same host, then create the websocket using the host used to fetch the web page:
conn = new WebSocket("ws://" + window.location.host + "/ws");
This will just work in all network configurations.
As far as the Go code is concerned, the easiest approach is to listen on all networks:
if err := http.ListenAndServe(":8080", nil); err != nil {
// handle error
}

Get running python server IP address in Javascript

I have a python flask app running on my server:
if __name__ == '__main__':
port = int(os.environ.get("PORT", 6600))
app.run(host='0.0.0.0', port=port)
And I have a JS script getting information from that app, I don't want to change manually th IP or domain in the JS script every time I deploy or change the domain so I'm asking is there any way for the JS to know the IP or hostname of the python app ?
Here's my structure:
index.py <= main app
static
**index.html
**script.js
Thanks
Register a domain name and stick with it. Use the domain name in your javascript and/or config.
Make sure that the registrar provides an interface for updating the "A record" (IP address) and point it at your server. Whenever you change IP address, update the A record for your domain.
If I understand your question correctly, you pretty much have two options at your disposal depending on your setup.
Option 1: If your JavaScript code is running on the same machine as your Python script, you could simply always just access it from 127.0.0.1 from your JavaScript code (because binding to 0.0.0.0 will make the Python server accessible from all interfaces, including the loopback interface at 127.0.0.1).
Option 2: If your JavaScript code lives on a remote server, your simplest solution is going to be to use some kind of Dynamic DNS service as an intermediary. So you'll end up with two domains for your Python server: one static one available to the rest of the world, like www.mypythonserver.com, and one dynamic DNS entry only known by your JavaScript code, like mypythonserver.noip.me (hard-coded permanently into your JavaScript code). Both of these domains should always resolve to your Python server's host address, with no manual intervention necessary for the dynamic DNS entry.
You can use the templating in the script file which would get filled with the port number when user requests the script.
There are many templates available at :
https://wiki.python.org/moin/Templating
Usually it would be like
// in script.js
var myport = {{ port }};
and in your python code :
# if request is for script.js
# respond with template
request.send(my_templating_engine('script.js' , port))

getting user IP, user_agent,refferer via websocket

I'm trying use websocket to my project.
to implement I've used this code http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket.
this chat works good, but in my project I must get statistics about visited user on webpage, so I need user IP, User_Agent, user referrer to recognize user.
My question is, how to get all this necessary data (user IP,browser user agent, refferer) via websocket?
And one more: to improve performance will better to use move code from php websocket to node.js with nginx server?
Use JavaScript at the client side, which will send this info using websocket.sendMessage() after the upgrade handshake.
And then you can maintain some data struture that would store that info w.r.t the session id of the client at the server side if you want to.
Try this
<script type="text/javascript">
function getip(json) {
alert(json.ip); // alerts the ip address
}
</script>
<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip">
</script>
The getip() method alerts the client IP as soon as the page is loaded.
You can now store the IP in a variable and send it to the server using websocket's send() method.
For browser UA, please read this.

How can a server find real client IP address?

I can only access the internet from my place from behind a NAT and a proxy. This site however also shows my machine's private LAN address, as well as my NAT's public address. They are apparently using javascript in the process, but I can only find code where they set the value, but not how they find it. So, how can we find out the private IP address of a client machine using javascript?
They're using Java for that:
<span class="pbb" id="lanip"><b>Router IP Address Testing...</b></span>
<script>
function MyAddress(IP)
{ document.getElementById("lanip").innerHTML = IP; }
</script>
<applet code="MyAddress.class" MAYSCRIPT width=0 height=0>
You Need To Enable Java For This To Work
</applet>
Are you sure you're behind just a NAT router? If you're behind a proxy, the proxy might well be adding an X-Forwarded-For header.

Categories

Resources