'Why AWS IVS Stream doesn't play?
I have a healthy streaming sent to AWS IVS.
When using the very same javascript code given by AWS to play the streaming, it's not working :
I got the code from here
<script src="https://player.live-video.net/1.7.0/amazon-ivs-player.min.js"></script>
<video id="video-player" playsinline></video>
<script>
if (IVSPlayer.isPlayerSupported) {
const player = IVSPlayer.create();
player.attachHTMLVideoElement(document.getElementById('video-player'));
player.load("https://b9ce18423ed5.someregion.playback.live-video.net/api/video/v1/someregion.242198732211.channel.geCBmnQ6exSM.m3u8");
player.play();
}
</script>
The playback URL is coming from the IVS channel.
When running this code, nothing happens and the video tag source is set to :
<video id="video-player" playsinline="" src="blob:null/b678db19-6b9a-42fc-979e-1e0eda4a3b46"></video>
There is no code from my side. It's only AWS code. Is that a bug or am I doing something wrong ?
Thanks. Regards,
Solution 1:[1]
Here is the reason why in my case the IVS stream didn't play. Maybe it may help someone else.
In my case, it was not playing because the video streamed was completely black. So it thinks the video stream is "empty". Once I got something in the video, it was playing properly.
Solution 2:[2]
You can confirm if the stream is healthy using the AWS Management console. If it's loading in the Live stream tab, then it should play in the AWS IVS player that you've integrated.
I used the below code & upon successful streaming, it was loading fine.
<!DOCTYPE html>
<html>
<head>
<!--Set reference to the AWS IVS Player-->
<script src="https://player.live-video.net/1.8.0/amazon-ivs-player.min.js">
</script>
<!--Create video tags-->
<video id="video-player" playsinline controls muted="true" height="500px" width="700px"></video>
<script>
//Once AWS IVS Player is loaded, it creates a global object - "IVSPlayer". We use that to create a player instance that loads the playback URL & plays it the connected video html element.
if (IVSPlayer.isPlayerSupported) {
const player = IVSPlayer.create();
player.attachHTMLVideoElement(document.getElementById('video-player'));
player.load("*PLACE_YOUR_PLAYBACK_URL_HERE{.m3u8 extention}*");
player.play();
}else{
console.warn("Error: Browser not supported!");
}
</script>
</head>
<body>
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Thomas Carlton |
Solution 2 | Kunal Behrunani |