![Live Streaming from Unity - Multi-Camera Streams (Part 6)](https://assets.community.aws/a/2ctX4G1zUeueiKGzOwR39N20x15/_uni.webp)
Live Streaming from Unity - Multi-Camera Streams (Part 6)
Let's see how to stream more than one camera to the same Amazon IVS stage.
Todd Sharp
Amazon Employee
Published Feb 27, 2024
So far in this series, we've looked at broadcasting from a game built in Unity to an Amazon Interactive Video Service (Amazon IVS) real-time stage, integrated chat, and enhanced the experience with viewer-controlled cameras, and dynamic objectives and environments. In this post, we'll talk about another possible use-case: multi-camera streams.
In addition to viewer-controlled camera views, wouldn't it be super cool to see the action from multiple POVs as a stream viewer? Building on the same concepts that we've established in this series, this is totally possible.
Because we have some functionality that will be shared across several scripts, we'll encapsulate some of the logic that we've been using in this series into a reusable
WebRTCUtils
class. This will allow us to establish multiple streams from our game.We'll use the 'FPS' demo game for this demo, and create a player camera to broadcast the player's POV just as we did before.
![Player cam Player cam](https://assets.community.aws/a/2ctXC0fvMTjfljZvdWGdrewIa82/1-pn.webp)
Next, create and associate a
WebRTCPlayerPublish
script.To add another camera for the main turret's POV, create an empty game object on the turret called
TurretCameraThing
.![Turret camera thing Turret camera thing](https://assets.community.aws/a/2ctXRlLACl76mXPWQt5B2jIxey7/2-pn.webp)
Because we want this camera to always look at whatever the turret is looking at, we'll need to create a
TurretCameraThing
script that is bound to the turret's health bar and update the turret camera's transform in Update()
.Now we can add a camera as a child of
TurretCameraThing
and attach a new WebRTCBossPublish
script that will broadcast this camera's view as a separate stream to the same Amazon IVS stage.Once we launch the game, we can see that both cameras are broadcasting their own view to the Amazon IVS stage!
In this post, we learned how to broadcast multiple cameras from a game built in Unity to an Amazon IVS real-time stage. In the next post, we'll switch gears and look at real-time stream playback in a Unity game.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.