Pull stream from live client (FMLE) only when a viewer is connected?
I'm currently setting up a streaming service / website for nature webcams, where people can register and stream their birdbox webcams etc., and weighing up the options I have. Users will connect their webcams to my server over RTMP (or RTMPT if needed), using Adobe FMLE.
Is it possible in this setup to get Wowza to
only pull the stream from the connected FMLE client when a viewer begins to watch the stream through the website? The problem I can foresee is that I could have 50+ clients connected 24/7 with 400kbps streams, when only a few of those streams could be being watched on the website at any one time. Not only is it a lot of data coming in to my server, it would mean clients using up 4GB+ of their upload on a daily basis, which could obviously cause all sorts of problems depending on what kind of internet package they are on.
Unreal Media Server has this exact feature - the client makes the connection to the server, but the server only then pulls live RTMP data when someone views the stream on the website. Problem is, Wowza is superior to UMS in pretty much every other way. It's a really annoying quandary which could make or break what I'm doing, so I'm really hoping there is a way to do this with Wowza!
It's possible to stop ingesting a stream when no clients are viewing but it has some particular restrictions and limitations. You would need to ensure that each of your webcam sources are defined in a stream file, so you'll need the RTSP URI of the cameras. Then create a new application and manually edit the [install-path]/conf/[app-name]/Application.xml and change the <StreamType> value to rtp-live.
You can then add the newly created stream files to "Startup Streams", to start up for this application.
Once the app has been restarted if you then attempt to play one of the stream URLs then Wowza will initiate an RTSP connection to the camera and pull in the stream. The stream will remain active so long as a Flash client is connected. Once the last connection drops off then the connection to the RTSP source also drops.
The obvious limitations are that you require RTSP in stream files as your source, so your use of an RTMP source would need to change. Also you really should only provide RTMP playback - HTTP based playback may work while the connection is up, but it won't instigate it, so HTTP streaming is not reliable in this setup.
I don't believe this will work with RTMP pull from FMLE as I believe that can only be used to push an RTMP stream? I'm not overly familiar with all of the features of FMLE though so there could be other ways to publish.
HTTP streams may work while a connection is active but if a client requests an HTTP playback type when the stream is not connected then it will fail as it can't initiate the connection to the camera source. You would need a Flash client connected to the stream first to ensure the connections are up, and of course dedicating a Flash client to maintain connectivity negates the benefits of dropping links when no clients are connected. So I'd not recommend the rtp-live stream type for anything other than RTMP.