Schedule the start of a file with the Wowza Video REST API
After you start a live stream or transcoder that streams a file, Wowza Video downloads the file from the specified URL, and then starts the stream. Because the transcoder has to start, which can take a few minutes, and the file has to download to the transcoder before playback can begin, there will be a delay between when the stream starts and when the file actually begins to play.
You can minimize this delay using the file:start_streaming_at
property. Use this property to break the start-up process into two
discrete steps:
- Start the transcoder a few minutes ahead of your scheduled start time to download the file and begin processing.
- Start the file stream at the scheduled start time.
Factors that impact the transcoder start up and file download time include the location of the file, the file size, and network conditions. Allow at least 5 minutes before the scheduled start time for starting the transcoder and downloading the file.
Before you start
You should have completed the following tasks:
- Create a live stream or a transcoder that streams a file . See Stream a file with the Wowza Video REST API for more information.
1. Schedule the start of the source file
You can use the following sample request, making sure to:
-
Set the
transcoder_id
in the request path to the transcoder ID for your transcoder or live stream. -
Set
value
to the month, day, year, and time of day that the file should start streaming. Express the value by using the ISO 8601 standard of YYYY-MM-DDTHH:MM:SSZ where HH is a 24-hour clock in UTC.
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${WV_JWT}" \
-d '{
"property": {
"key": "start_streaming_at",
"section": "file",
"value": "2020-04-30 04:00:00 UTC"
}
}' "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/properties"
2. Start the transcoder ahead of the scheduled stream start time
Prior to the scheduled start time of the source file, start the transcoder. Allow at least 5 minutes before the scheduled start time, depending location of the file, the file size, and network conditions.
You can use the following sample request, making sure to:
-
Set the
transcoder_id
in the request path to the transcoder ID for your transcoder or live stream.
curl -X PUT \
-H "Authorization: Bearer ${WV_JWT}" \
"${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/start"
Info
Wowza Video allows you to specify an idle timeout value to automatically stop the transcoder if no video is received after a specified length of time. The default value is 20 minutes. Make sure that the idle timeout isn’t set to occur before the scheduled start time. Otherwise, the transcoder will stop and the file won’t stream.
Next steps
- PUT/transcoders/ID/stop — Stop the transcoder when the stream is completed.