Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.1.0-exp.2] - 2021-12-01

### Added

- Added audio streaming receiver.
- Added the `Multiplay` scene into samples.
- Added components for streaming.
  - `MicrophoneStreamSender`
  - `AudioStreamReceiver`
  - `ScreenStreamSender`
- Added components for controlling user input.
  - `InputSender`
  - `InputReceiver`

### Changed

- Upgraded WebRTC package to `2.4.0-exp.4`.
- Upgraded Input System package to `1.0.2`.
- Renamed components.
  - `CameraStreamer` -> `CameraStreamSender`
  - `ReceiveVideoViewer` -> `VideoStreamReceiver`
  - `WebCamStreamer` -> `WebCamStreamSender`
  - `AudioStreamer` -> `AudioStreamSender`
  - `InputSystemChannnelSender` -> `InputSender`
  - `InputSystemChannnelReceiver` -> `InputReceiver`
- Improved controlling user input from browsers.
- Updated manual documents.

### Fixed

- Fixed resource leak of sender stream tracks.
  • Loading branch information
Unity Technologies committed Dec 1, 2021
1 parent aacf8f7 commit 0e9bb06
Show file tree
Hide file tree
Showing 236 changed files with 15,175 additions and 6,307 deletions.
45 changes: 44 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,54 @@ All notable changes to com.unity.renderstreaming package will be documented in t
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [3.1.0-exp.1] - 2021-05-28
## [3.1.0-exp.2] - 2021-12-01

### Added

- Added audio streaming receiver.
- Added the `Multiplay` scene into samples.
- Added components for streaming.
- `MicrophoneStreamSender`
- `AudioStreamReceiver`
- `ScreenStreamSender`
- Added components for controlling user input.
- `InputSender`
- `InputReceiver`

### Changed

- Upgraded WebRTC package to `2.4.0-exp.4`.
- Upgraded Input System package to `1.0.2`.
- Renamed components.
- `CameraStreamer` -> `CameraStreamSender`
- `ReceiveVideoViewer` -> `VideoStreamReceiver`
- `WebCamStreamer` -> `WebCamStreamSender`
- `AudioStreamer` -> `AudioStreamSender`
- `InputSystemChannnelSender` -> `InputSender`
- `InputSystemChannnelReceiver` -> `InputReceiver`
- Improved controlling user input from browsers.
- Updated manual documents.

### Fixed

- Fixed resource leak of sender stream tracks.

## [3.1.0-exp.1] - 2021-06-15

### Added

- Android platform support
- Added the Menu scene into samples

### Changed

- Added drop-down list UI for selecting the video capture device in the `Bidirectional` scene
- Changed the signaling process for exchanging SDPs

### Fixed

- Fixed errors when disposing the scene while streaming video
- Fixed the long processing time when disposing the signaling instance

## [3.0.1-preview] - 2021-03-04

Expand Down
22 changes: 16 additions & 6 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
* [Unity Render Streaming](index.md)
* [About Unity Render Streaming](index.md)
* [Overview](overview.md)
* [Tutorial](tutorial.md)
* [Project Template](template.md)
* [Developing a streaming application](dev-streaming-app-intro.md)
* [Installing The Package](installation.md)
* [Launching The Web Application](launch-webapp.md)
* [Creating The Scene](create-scene.md)
* [Setting Up Device Input](control-camera.md)
* [Web Application](webapp.md)
* [Browser Input Process](browser_input.md)
* [Configure Self-Signed Credentials for https](https.md)
* [Setting for TURN Server](turnserver.md)
* [About Signaling Protocol](signalingprotocol.md)
* [Customize Web Application](customize_webapp.md)
* [About Signaling Type](signaling-type.md)
* [Customize Web Application](customize-webapp.md)
* [Components Settings](components.md)
* [Streaming Management](streaming-management.md)
* [Video Streaming](video-streaming.md)
* [Audio Streaming](audio-streaming.md)
* [Data Streaming](data-streaming.md)
* [Using with Input System](use-inputsystem.md)
* [Deploy to Furioos](deploy-to-furioos.md)
* [Samples](samples.md)
* [Receiver](sample-receiver.md)
* [Broadcast](sample-broadcast.md)
Expand All @@ -17,4 +25,6 @@
* [AR Foundation](sample-arfoundation.md)
* [Gyroscope](sample-gyroscope.md)
* [Web Browser Input](sample-browserinput.md)
* [Multiplay](sample-multiplay.md)
* [Project Template](template.md)
* [FAQ](faq.md)
40 changes: 40 additions & 0 deletions Documentation~/audio-streaming.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Audio Streaming

`AudioStreamSender` class and `AudioStreamReceiver` class are the base classes for sending and receiving audio. And various components are implemented using inheritance relationships with these class. Components are provided for the sender and receiver.

> [!NOTE]
> There is currently a limitation in the audio codec selection. Currently, only **Opus** is used for the audio codec.
## `AudioStreamSender` component

This component streams the audio rendering results from [`AudioListener`](https://docs.unity3d.com/ScriptReference/AudioListener.html) component or [`AudioSource`](https://docs.unity3d.com/ScriptReference/AudioSource.html) component.

![AudioStreamSender inspector](images/audiostreamsender_inspector.png)

### Properties

| Parameter | Description | Default |
| --------- | ----------- | ------- |
| **Audio Source** | [`AudioSource`](https://docs.unity3d.com/ScriptReference/AudioSource.html) instance for sending audio | None |

## `MicrophoneStreamSender` component

This component streams the audio rendering results from [`Microphone`](https://docs.unity3d.com/ScriptReference/Microphone.html).

![MicrophoneSender inspector](images/microphonesender_inspector.png)

### Properties

| Parameter | Description | Default |
| --------- | ----------- | ------- |
| **Audio Source** | [`AudioSource`](https://docs.unity3d.com/ScriptReference/AudioSource.html) instance for sending audio | None |
| **Device Index** | An index of the list of available microphone devices | 0 |

An index of the list of available microphone devices


## `AudioStreamReceiver` component

The components receive audio track stream and rendering to [`AudioSource`](https://docs.unity3d.com/ScriptReference/AudioSource.html).

![AudioStreamReceiver inspector](images/audiostreamreceiver_inspector.png)
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ If use UnityUI in the background, follow the steps below.

1. Update `com.unity.inputsystem` to `1.1.0-preview.2` on PackageManager.

2. In Project Setting->Player->Other Setting, check `Allow 'unsafe' code`.
2. In **Project Setting > Player > Other Setting**, check `Allow 'unsafe' code`.

3. Replace `EventSystem` in the Scene with the following component.

Expand Down Expand Up @@ -153,4 +153,4 @@ public class CustomEventSystem : EventSystem
}
```

4. (Optional) For UnityEditor, Open Window->Analysis->Input Debugger and turn on `Lock Input to Game View` in Options.
4. (Optional) For UnityEditor, Open **Window > Analysis > Input Debugger** and turn on `Lock Input to Game View` in Options.
155 changes: 5 additions & 150 deletions Documentation~/components.md
Original file line number Diff line number Diff line change
@@ -1,153 +1,8 @@
# Components Settings

## `Render Streaming`
This package provides some useful components to make the streaming feature to the application made with Unity.

**Render Streaming** includes the following features.

- Communication with signaling servers
- Streaming input from cameras
- Associating browser input with events

![Render Streaming Inspector](images/renderstreaming_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| **Signaling Type** | Class type of the signaling | `WebSocketSignaling` |
| **Signaling URL** | Set the signaling server URL <br>If you use WebSocket as a signaling protocol, you should specify a URL starting with `ws` or `wss`. | `ws://localhost` |
| **Ice Servers** | Set a list of STUN/TURN servers | |
| *Urls* | Set URLs of STUN/TURN servers | `[stun:stun.l.google.com:19302\]` |
| *Username* | The username to use when logging into the TURN server | |
| *Credencial* | The credential to use when logging into the TURN server | |
| *Credencial Type* | This attribute specifies what kind of `credential` is to be used when connecting to the TURN server | `Password` |
| **Interval** | Set the polling frequency (in seconds) to the signaling server <br>Valid only if you are using Http as the signaling protocol. | 5 (sec) |
| **Hardware Encoder Support** | Enable the checkbox to make this video encoding replace values that use a [hardware encoder](index.md#hardware-encoder) | `False` |
| **Handlers** | Register browser button click events | |
| **Run On Awake** | Automatically started when called `Awake` method | `True` |

## `CameraStreamer`

This component streams the `Camera` component's camera rendering results. Uses `Target Texture` to store the rendering results.

> [!NOTE]
> You can attach the `Target Texture` to the `Camera` component.
> If `Target Texture` is attached on Camera, use that `Render Texture` setting first.
![Camera Streamer inspector](images/camerastreamer_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streaming Size** | Size of the frame buffer used for streaming | 1280, 720 |
| **Anti-aliasing** | The antialiasing level for the RenderTexture | None |
| **Depth Buffer** | The precision of the render texture's depth buffer in bits | No depth buffer |

## `WebCamStreamer`

This component streams the `WebCamTexture` rendering results. Please refer [WebCamTexture](https://docs.unity3d.com/ScriptReference/WebCamTexture.html) pages.

![WebCam Streamer inspector](images/webcamstreamer_inspector.png)

> [!NOTE]
> When building application for iOS platform, you need set `Camera Usage Description` on Player Settings.
> If not set this, your application exits. (refer [this page](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW24))
![Set Camera Usage Description](images/sample_bidirectional_camerausagedescription.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streaming Size** | Size of the frame buffer used for streaming | 1280, 720 |
| **Device Index** | Index of `WebCamTexutre.devices` to use | 0 |

## `AudioStreamer`

This component streams the `AudioListener` component's audio rendering results.

### Properties

None

## `ReceiveVideoViewer`

This component receives a videostream and exposes a texture that rendered the receiving frame buffer.

![Receive Video Viewer inspector](images/receivevideoviewer_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streaming Size** | Size of the frame buffer used for streaming | 1280, 720 |
| **Connection Id** | ID of receiving videostream | Empty |

## `InputSystemChannelSender`

This component sends input events from Unity.

![InputSystem Channel Sender inspector](images/inputsystemchannelsender_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Local** | Channel is local or remote | `False` |
| **Label** | Channel label | Empty |

## `InputSystemChannelReceiver`

This component receives input events from Unity.

![InputSystem Channel Receiver inspector](images/inputsystemchannelreceiver_inspector.png)


### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Local** | Channel is local or remote | `False` |
| **Label** | Channel label | Empty |

## `WebBrowserInputChannelReceiver`

This component receives input events from web browsers.

![Web Browser Input Channel Receiver inspector](images/webbrowserinputchannelreceiver_inspector.png)


### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Local** | Channel is local or remote | `False` |
| **Label** | Channel label | Empty |
| **Array Button Click Event** | Register browser button click events | [] |
| *Element Id* | Set an ID that is sent from browsers | |
| *Click* | Set button click event | |

## `SingleConnection`

This component lists components that stream media or data via a single peer connection.

![Single Connection inspector](images/singleconnection_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streams** | List of streams | [] |

## `Broadcast`

This component lists components that stream media or data via multiple peer connections.

![Broadcast inspector](images/broadcast_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streams** | List of streams | [] |
- [Streaming Management](streaming-management.md)
- [Video Streaming](video-streaming.md)
- [Audio Streaming](audio-streaming.md)
- [Data Streaming](data-streaming.md)
83 changes: 83 additions & 0 deletions Documentation~/control-camera.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Setting Up Device Input

To control the camera on the remote PC, we need to link the input events on web browsers to the actions in Unity. **Input System** makes it easy to implement the input processing.

## Adding components for input processing

Open the Unity scene which created in [the previous page](create-camera.md), and select **Main Camera** in the Hierarchy window. Add the **Input Receiver** component in the Inspector window.

![Add InputReceiver component](images/add_inputreceiver_component.png)

The initial condition of the inspector of **Input Receiver** is below.

![Add InputReceiver component](images/inputreceiver_inspector.png)

## Setting Input Actions

We will use the [**Input Actions**](https://docs.unity3d.com/Packages/[email protected]/manual/Actions.html) feature of the Input System. Input Actions is a mechanism for mapping various inputs to Unity actions, and it provides editing tools that make it easy for anyone to use. We will use Input Actions to define mouse actions.

Right-click in the project window, and then click **Create > Input Actions**.

![Control camera 01](images/control_camera_01.png)

The asset will be added to the project window and rename to **Control**. Double-click on the **Control** asset in the project window, and the **Action editor** will appear.

![Control camera 01](images/control_camera_02.png)

Click the **+** button in **Actions Maps** to add an item.

![Control camera 01](images/control_camera_03.png)

Rename the **Actions** item to `Look`.

![Control camera 01](images/control_camera_04.png)

Select the item and change **Action Type** to `Value`, and **Control Type** to `Vector2`.

![Control camera 01](images/control_camera_05.png)

Next, select the **\<No Binding\>** item and add **Mouse > Delta** to the **Path** of **Binding**.

![Control camera 01](images/control_camera_06.png)

The result will look like this. Note that the last step is to press the **Save Asset** button to save your edits.

![Control camera 01](images/control_camera_07.png)

## Setting `InputReceiver` component

Drag the **Control** asset to the **Input Actions** property of the `InputReceiver` component.

![Control camera 01](images/assign_inputactions_to_inputreceiver.png)

Add the code to control the rotation of the camera. Move to the Inspector window, click **Add component** button and select **New Script** Script to create the asset. Change the asset name to `PlayerControler`.

![Create Player Controller component](images/create_playercontroler_component.png)

The contents of the script will be as follows.

```csharp
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
public void Look(InputAction.CallbackContext value)
{
Vector2 input = value.ReadValue<Vector2>();
transform.eulerAngles += new Vector3(-input.y, input.x, 0);
}
}
```

Once you have copied the script and saved the file, assign `PlayerController.Look` to the **InputReceiver** component's **Look** event.

![Control camera 01](images/assign_event_to_inputreceiver.png)

## Checking on browsers

The mouse operation in the browser should be reflected in the rotation of the camera. If the camera is not moved, please check [the settings](use-inputsystem.md).

## Next step

We were able to incorporate the input processing using the Input Actions feature. If you would like to learn more about the features of Unity Render Streaming, please see the [Sample page](samples.md). Also, check out [Customizing your web application](customize-webapp.md) for information on how to modify the web user interface.
Loading

0 comments on commit 0e9bb06

Please sign in to comment.