Find out when a video recording started?

We are planning on doing live streams, and we expect that our users would like check everything is ok before they start. Our plan is then to allow this before the stream is scheduled to start (on our website).

This stream/video must then typically be stopped at least 5 minutes in advance, and the actual live stream should start maybe 30 seconds before the stream is live on our site.

After the event has ended we plan on publishing the video so our customers can watch after the fact.

So here is the problem, how can I see when a video was started to record? This is so we can avoid showing the practice run. As far as I can tell, the /video/id only gives publishedAt and updatedAt ,which in this case is the same. Which is when the video was finally available in api.video.

Is there a way to get the timestamp when the video was recorded? I understand this is not normal for regular video’s, but for us it is pretty important.

I suppose it is possible to use the started webhooks timestamp, followed by ended and then recorded, to get this, but very complicated. And if webhooks are not always in order, that may not be a good assumption.

Cheers,
Alf

Maybe the best approach is to PATCH the livestream with record: true a minute before, and record: false after? That way it should not contain any videos outside our “live window”.

Hi @alf.kristian,

Great questions.

If you change the record attribute during a live stream, it will not take effect until after the livestream is over.

Let’s walk through an example:

You have a livestream scheduled for 12:00:

  1. You user runs a short test at 11:30 (or 11:55) to make sure the livestream works. If record is set to true - you’ll get a short recording in your account of someone saying “test test test”
  2. Live stream starts at 11:59 witha “your livestream will start soon” type of message.
  3. at 12:00, you remove the message and begin the live stream.

As long as there is a 60 gap between the test and the live stream starting (between end of 1 and start of 2 - you will have 2 unique recordings, with unique videoIds. This will make it very easy to skip the practice.

Doug

1 Like

A bit more detail on our live webhooks (that is more than you asked, but I think it is interesting)

The live streaming webhook announces when broadcasting starts - and this is in real time - so you don’t have to worry about them being out of order.

Lets look at an example set of webhooks from my livestream: watch.a.video/broadcast

This stream starts every hour at 25 minutes past the hour, and ends at 24 minutes past the hour, and then there is a recording created, and we see each version when they are ready. from the timestamps below, it appears that the clock on my Raspberry pi ~10 seconds off from the api.video servers :slight_smile:

You can see this (or a representative webhook) at webhook.a.video.

  • New api.video event
  • event: live-stream.broadcast.started at: 2021-09-15T05:25:10.493037517Z LiveStream,Id: liEJzHaTzuWTSWilgL0MSJ9 has started.
  • New api.video event
  • event: live-stream.broadcast.ended at: 2021-09-15T06:24:11.447395587Z LiveStream,Id: liEJzHaTzuWTSWilgL0MSJ9 has stopped.
  • New api.video event
  • event: live-stream.broadcast.started at: 2021-09-15T06:25:09.37079257Z LiveStream,Id: liEJzHaTzuWTSWilgL0MSJ9 has started.
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:29:15.450519606Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: hls Video quality: 240p
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:31:26.54694262Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: hls Video quality: 360p
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:31:56.294521564Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: hls Video quality: 480p
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:32:11.834689668Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: hls Video quality: 720p
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:42:14.979294418Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: hls Video quality: 1080p
  • New api.video event
  • event: video.encoding.quality.completed at: 2021-09-15T06:43:49.27566748Z videoId: vi7EwjFR9Zga3l36aNqOy6o4
    Encoding: mp4 Video quality: 1080p
  • New api.video event

The live-stream.broadcast.started event will give you the time you want for when the recording began, and the event video.encoding.quality.completed will tell you in real time when the recording is ready.

Doug

1 Like