Embedding with RTMP
You can live stream to your website with Agent via YouTube or Twitch or any other RTMP provider.
To set this up with YouTube follow the steps below:
- Sign into your youtube account and go to https://www.youtube.com/live_dashboard
- Create a new Live Stream and make a note of the Server URL and your Stream name/key
- Back in Agent, click on your Server and then the settings tab and click the Settings button
- Click on the tab "Streaming". Enter the URL and the Stream Key from step 2 here. You may want to adjust the maximum duration. The default is set to 900 seconds (15 minutes)
- Click OK.
- Back in YouTube, right click on the live player on the website and click "Copy embed code". Your clipboard will now contain the HTML you need to paste into your webpage.
Once these steps are completed you can start live streaming to your website:
Add an RTMP server to Agent - Click on Server Menu, Settings (under Configuration) - select RTMP Streaming and Add a new server. You can control the resolution using the Size dropdown and the bitrate using the Quality slider. If your stream is buffering frequently then try reducing the size or the quality or both to get smooth playback.
Click the Server menu and RTMP Streaming in the System menu. Click the "..." button next to your RTMP server entry to configure the device or view to live stream.
The stream to your RTMP platform should start. Give it a few seconds to buffer.
Edit a device and set the RTMP server to use under the General tab and check the "Scheduling" switch. Click to edit the Scheduler underneath. Add a schedule command "RTMP Streaming Start" and set the times and days. Then add an "RTMP Streaming Stop" command.
Scheduling View Streaming
To setup scheduled view streaming you will need to add an Action to a device and then schedule a call to that action:
- After adding the RTMP server, go to http://localhost:8090/q.json?cmd=getstreamingstatus and copy the ident of the RTMP server you want to use (excluding the quotes)
- Add an action to the device with If: None, then: Call URL, URL: http://localhost:8090/q.json?cmd=start-rtmp-view&ident=ident&ind=0 where ind is the index of the view you want to stream (from 0-8)
- Add a schedule entry in the device scheduler for "Action: Run" and select the action you just created.
You can add another action/ schedule entry to stop using the URL http://localhost:8090/q.json?cmd=stop-rtmp&ident=ident. Make sure the schedule is enabled on the General tab.
Embedding with FTP
Add an FTP server in Server Settings and set the Rename option to On. Edit a camera and select the FTP tab and set a fixed filename so Agent will continually overwrite the frame. Make sure the mode is set to Interval. Set the interval to 0.1 for 10 fps.
To display the feed on your website just copy and paste the following HTML code into your webpage (you'll need to modify the _targetimage variable to point to the image you are uploading). This will only work if you have specified a static path to your uploaded image (ie it continually over-writes the same file).