using Managed Media Aggregation - stream

I have been trying to use the Managed Media Aggregation Open Source.
I have a server that is getting its source from another PC in my LAN.
a few issues:
I got my RtspClient to connect to my server,
now I want to be able to work with the client (send play, pause, and actually see where the video plays) and haven't found any code examples for this.
I want to be able to stream a local video file in my computer through my server, is there a way to do it?
I tried to connect from VLC on my PC to the server (localhost) - did'nt work..
Here is my code:
public ServerExample()
{
//Create the server optionally specifying the port to listen on
server = new RtspServer(554);
source = new RtspSourceStream("RtspSourceTest",
"rtsp://192.168.30.11:5544/stream");
// Add the stream to the server
server.AddStream(source);
// Start the server and underlying streams
server.Start();
//The server is now running, you can access the stream with VLC, QuickTime, etc
AccessWithClient();
}
private void AccessWithClient()
{
RtspClient client = new RtspClient("rtsp://localhost:554/RtspSourceTest", RtspClient.ClientProtocolType.Tcp);
client.Connect();
}
any thoughts?
thanks!

I'm the author of that library.
Your example looks correct, Stack Overflow is not a forum for my library.
Post questions https://net7mma.codeplex.com/discussions if you need to after reviewing the other discussions to ensure your question is not answered.

Related

How to find out what my live stream URL is?

I am trying to stream from obs or similar to maybe restream, but I also want to send the feed to a custom RTMP player on my site, it's asking for the Live Streaming URL. How can I find that?
I believe obs asks you to connect to a streaming platform (I think this is what you meant by "restream"). Depending on the platform you are streaming to (Twitch, Youtube, etc), then you would need to get the URL from that site. Connect to one of these first and it should give you a URL. I think YouTube requires 24 hours to enable live streaming.
If you can stream directly to your website I am not aware of it. Reason being, in most cases you have a dynamic IP or port that is not open for your website to view the original stream from your Obs software/computer.

How to get Realm from the server?

Is it impossible to get Realm from the server?
I tried this, but it doesn't work.
var url = "http://address/default.realm"
var rlm = RLMRealm(path: url)
Error message says 'No such file or directory'.
What you're trying isn't supported in this way.
If you want to use a Realm on the server side to seed your database, you would need to download it first and save it to the local filesystem of the device to load it from there.
If you want to sync data between the device and your server or across multiple devices, then you may be interested that this is a feature, on which we are working on. Subscribe this issue to keep up-to-date about it's current stage.

How to I access a SoundCloud public stream?

How do I play a track from a SoundCloud URL, which, for example, I got from the xml response from a query
<stream-url>https://api.soundcloud.com/tracks/31164607/stream</stream-url>
I should have thought that it would have been as easy as:
https://api.soundcloud.com/tracks/31164607/stream&client_id=my_client_id
yet I get
<error>401 - Unauthorized</error>
All I want to do is consume it in a Silverlight MediaElement, so all I need is set some url to the MediaElement's Source property.
I've checked an application that I wrote about 2 years ago, and THEN, accessing the stream url was as easy as this for a public track:
http://api.soundcloud.com/tracks/18163056/stream&consumer_key=MY_CONSUMER_KEY
however this no longer seems to work.
For example, all I had to do then in C# was:
MediaElement me = new MediaElement();
me.Source= new Url("http://api.soundcloud.com/tracks/18163056/stream&consumer_key=MY_CONSUMER_KEY");
me.Play();
Any hints would be appreciated.
I had a reply on a Microsoft forum that seems to imply that SoundCloud might not be possible to stream to Windows 8 Metro devices without consuming the whole stream before playback starts - which is quite worrying and would seem to imply that to make authentication possible, it would have to be done entirely in the url querystring insterad of using the header:
(The following reply is the answer to the following question: 'I am able to access an audio stream by http using the MediaElement, however I need to access it via https in which I need to add the oAuth info to the header of the initial request.
How is this done when using a MediaElement, and if it cannot be done, what is the workaround for consuming an audio feed in Metro 8 that requires header authentication to stream?')
"Direct access to the underlying network stream is not currently permitted by the MediaElement. Because of this there is currently no way to modify the header of the HTTP request to include any additional authentication information. That said, you do have control over the URL. You could theoretically setup an HTTP proxy service that translated the HTTP GET request parameters into the necessary oAuth credentials. Keep in mind that this is just a theoretical workaround. You may find different behavior in practice. Another theoretical workaround would be to handle the oAuth yourself via a raw stream socket and pass the retuned media data to the MediaElement via "Set Source" and a "Random Access Stream". Please keep in mind that this method has major limitations. in order to use a "Random Access Stream" with the ME you need to make sure all of the data is available before passing it to the ME."
The proxy service is not scalable for an application that is merely distributed for free as every stream would need to come via the proxy. And the raw stream socket, although getting around this, would mean that playback could not start until the whole file had downloaded - and this goes against all current UX (User Experience) guidelines.
So once again, if anyone has any tips, or info about how the whole authentication thing can be achieved in a querystring instead of using headers, I'd appreciate it!
I'm a little confused about whether you're referring to a public or a private track? If it's a public track, then you shouldn't need to send any authentication information, just your client id.
When I request https://api.soundcloud.com/tracks/31164607/stream?client_id=YOUR_CLIENT_ID then I get a 302 redirect to the proper mp3 stream.
Remember, adding parameters to a URL must start with a ? not &. This could (more than likely) be the reason why you are getting a 401 (SC is not picking up the client_id).
After authentication the link like this
http://api.soundcloud.com/tracks/103229681/stream?consumer_key=d61f17a08f86bfb1dea28539908bc9bf
is working fine. I am using Action Script.
I'm following up on Tom's reply because he calls attention to url character specificity. My HTTP requests randomly started failing today, and I was prefacing my client_Id with a ?. As soon as I changed that single ? to &, it started working. So in my case, SC wasn't picking up my client_Id because I used the wrong character. I think depending on where in the request we're talking about specifically, it's worth noting that differences between ? and & do make a difference.

SignalR.Client On -eventhandler is not receiving any events

Premise:
I have a windows service, which acts as a client to an IIS-based ASP.NET MVC3 application. They are both running on the same machine, and I'm trying to make them communicate with each other through SignalR.
I'm using the SignalR.Client library downloaded from Nuget on the windows service, and I have successfully connected it to the IIS. However, now that I'm calling a function from the MVC side SignalR Hub, which should propagate to the clients (including my Windows Service) - the Windows Service is not receiving any events.
What I've tried:
I've tried subscribing to the server side events in many ways but here is my current code:
private static Connection WebUIConnection = new HubConnection(ConfigurationManager.AppSettings["localIISLocation"]);
private static IHubProxy webUiHubProxy = new HubProxy(WebUIConnection, "Hub");
----
WebUIConnection.Credentials = new System.Net.NetworkCredential(userName, password);
webUiHubProxy.On("invoke", () => Console.WriteLine("Derp"));
WebUIConnection.Start().Wait();
On the IIS side I then call:
Clients.invoke();
So, I've tried invoking things from the windows service, and those work perfectly, however - when the information needs to go from IIS-> Windows Service, absolutely nothing happens.
Now, seeing as the SignalR has dynamic binding going inside it, I don't see any exceptions being thrown and I have absolutely no idea how to approach debugging this. I've checked the application logs with Event Viewer, and there is nothing inconclusive there.
I'm thinking, if maybe there is a system in place in Windows which disallows IIS to connect to the local machine (as a security measure), but it is weird that the connection is working perfectly in one direction and not the other.
Any ideas on how to debug this, or in fact what this could be about?
Best regards,
Lari

Netty Channel closed detection

I am building a server client application using netty and ios, I am facing a problem when the user just turns off WiFi on his/her ios device, the netty server does not know about it.
The server needs to know to do cleanup for that user and set him/her offline, but now when the user tries to connect again, the server just tells him that he/she is already online.
If I understood your problem correctly: You want to listen for client channel closed events in server side and do some session cleanup,
There are two ways to listen for channel closed events in Netty :
1) If your server handler extends SimpleChannelHandler/SimpleChannelHandler, then you can override following method and write your session cleanup logic there
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception;
2) If you have only access to the channel reference, then you can get the channel close future and register your implementation of ChannelFutureListener with your session cleanup logic,
ChannelFuture closeFuture = channel.closeFuture();
closeFuture.addListener(new ChannelFutureListener() {
#Override
public void operationComplete(ChannelFuture future) throws Exception {
//session cleanup logic
}
});
Use IdleStateHandler
You can detect when there is no request/responses in given time intervals.
well the question is 9 years old a lot has happened since then
2008 Economic Collapse, Wars, Coronavirus.
On the bright side small Stock-Retailers seem to be winning the war against Hedge-funds on Wall-Street.
Back to the Question:
We were facing a similar problem where we had to provide a log message on the server-side every-time a client would close the channel.
The solutions provided above did not help but after 9 years a lot might have also changed in Netty.
Instead we extended our handler with the "MessagetoMessageDecoder" which also extends the ChannelInboundHandlerAdapter.
We then override the void method "channelUnregistered" which triggers when a channel is unregistered from its EventLoop.
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelUnregistered();
//Your logic goes here...
}
This also works when the server itself closes the channel.
Hope this helps somebody.
Check session id and allow renegotiation. Or you may use something like cookie controller.
May I ask off topic question: How does your client on ios interact with netty server? (what framework you use on client side, and what decoder/encoder use? )

Resources