AWS IVS: Include preview image before and after live video stream

0

Can you tell me how to include a preview image to display before the live video starts and then after the live video is over?

I want to embed the video into a website and do the following:

  1. Show a static preview image on the page until the live broadcast starts
  2. When the live broadcast starts, automatically replace the preview image with the live video feed
  3. When the live broadcast ends, it should automatically display the same preview image as before

Thank you!

profile picture
asked 2 years ago519 views
1 Answer
0

The IVS Player SDK does not support this functionality out of the box. To implement a functionality like this, a custom solution will need to be created. See below a recommendation on one avenue for potentially implementing this functionality.

  1. Show a static preview image on the page until the live broadcast starts.

The HTML video tag can handle this via the "poster" attribute. If the IVS stream has started, the player state is set to play and the player loads the playback url, this static image will transition to the live stream. When the player state has stopped after the livestream ends, the static image will resume.

  1. When the live broadcast starts, automatically replace the preview image with the live video feed.

It is possible to be able to find out when a stream goes live by setting up watchable events in Amazon EventBridge for IVS (https://docs.aws.amazon.com/ivs/latest/userguide/eventbridge.html). These events can be received by various processes that could be responsible with providing the UI the information it needs to cause the player to load the url.

  1. When the live broadcast ends, automatically display the same preview image as before.

Following the logic described in point 2, this custom process should also be configured to notify the UI when the stream has ended and potentially use the player.delete() method. This method will return the poster state on the HTML video tag. It is important to note that on player.delete() the playback is stopped and it will not longer emit events or respond to API calls. So if this method is utilized, another player instance will need to be initiated to continue playback.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions