Skip to content

Commit 82cb3b7

Browse files
decentraland cast (#228)
* cast documentation * Update video-playing.md Signed-off-by: Nicolas Earnshaw <[email protected]> * Save Tue Aug 15 04:25:19 PM -03 2023 --------- Signed-off-by: Nicolas Earnshaw <[email protected]> Co-authored-by: Nicolas Earnshaw <[email protected]>
1 parent bd37edc commit 82cb3b7

File tree

3 files changed

+71
-8
lines changed

3 files changed

+71
-8
lines changed

content/creator/sdk7/media/video-playing.md

+47-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ url: /creator/development-guide/sdk7/video-playing/
99
weight: 2
1010
---
1111

12-
There are two different ways you can show a video in a scene. One is to stream the video from an external source, the other is to pack the video file with the scene and play it from there.
12+
There are tree different ways you can show a video in a scene:
1313

14-
In both cases, you use a `VideoPlayer` component to control the state of the video. You also need to create a `VideoTexture`, which can be used on a [material]({{< ref "/content/creator/sdk7/3d-essentials/materials.md" >}}) and then applied to any [primitive shape]({{< ref "/content/creator/sdk7/3d-essentials/shape-components.md" >}}) like a plane, cube, or even a cone.
14+
- Upload a video file as part of the scene contents
15+
- Stream the video from an external source
16+
- Stream live via Decentraland cast
17+
18+
In all cases, you'll need:
19+
20+
- An entity with a [primitive shape]({{< ref "/content/creator/sdk7/3d-essentials/shape-components.md" >}}) like a plane, cube, or even a cone.
21+
- A [material]({{< ref "/content/creator/sdk7/3d-essentials/materials.md" >}}) with a A `VideoTexture` assigned to its texture
22+
- A `VideoPlayer` component to control the state of the video.
1523

1624
{{< hint warning >}}
1725
**📔 Note**: Keep in mind that streaming video demands a significant effort from the player's machine. For this reason, we recommend never having more than one video stream displayed at a time per scene. Videos are also not played if the player is standing on a different scene. Also avoid streaming videos that are in very high resolution, don't use anything above _HD_.
1826
{{< /hint >}}
1927

2028
## Show a video
2129

22-
The following instructions apply both to streaming and to showing a video from a file:
30+
The following instructions apply to all three video showing options:
2331

2432
1. Create an entity to serve as the video screen. Give this entity a `MeshRenderer` component so that it has a visible shape.
2533

@@ -69,7 +77,10 @@ VideoPlayer.create(screen, {
6977
})
7078
```
7179

72-
## About Streaming
80+
See [Streaming using Decentraland cast](#streaming-using-decentraland-cast) for details on how to use this third alternative method.
81+
82+
83+
## About External Streaming
7384

7485
The source of the streaming must be an _https_ URL (_http_ URLs aren't supported), and the source should have [CORS policies (Cross Origin Resource Sharing)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) that permit externally accessing it. If this is not the case, you might need to set up a server to act as a proxy and expose the stream in a valid way.
7586

@@ -89,6 +100,36 @@ See [Required permissions]({{< ref "/content/creator/sdk7/projects/scene-metadat
89100

90101
To launch your own video streaming server, we recommend using a [Node Media Server](https://github.com/illuspas/Node-Media-Server), which provides most of what you need out of the box. See
91102

103+
## Streaming using Decentraland Cast
104+
105+
You can livestream from your camera or share your screen using [Decentraland Cast]({{< ref "/creator/worlds/cast.md">}}). This streaming method uses the same comms architecture used for live communications between players, and is easy to set up and has a lot less delay than streaming from external sources.
106+
107+
{{< hint warning >}}
108+
**📔 Note**: Decentraland cast is only available to use in a World, not in scenes published to Genesis City. See [Decentraland Cast]({{< ref "/creator/worlds/cast.md">}}) for more information. As Worlds have a limited capacity of maximum 100 players at a time, this streaming method can only reach that maximum amount.
109+
{{< /hint >}}
110+
111+
112+
Call `getActiveVideoStreams` to fetch a list of all live streams active in the current World. The example below uses the first stream returned by this method:
113+
114+
```ts
115+
const { streams } = await getActiveVideoStreams({})
116+
if (streams.length > 0) {
117+
const stream = streams[0]
118+
VideoPlayer.createOrReplace(screen, {
119+
src: stream.trackSid,
120+
playing: true
121+
})
122+
console.log(`playing ${stream.identity} ${stream.sourceType} stream`)
123+
}
124+
```
125+
126+
Each stream returned by `getActiveVideoStreams` contains the following fields:
127+
128+
- `trackSid`: contains a unique track id that allow the player to play the video stream
129+
- `identity` : the address of the person that is streaming
130+
- `sourceType`: can be `VideoTrackSourceType.VTST_SCREEN_SHARE` or `VideoTrackSourceType.VTST_CAMERA`
131+
132+
92133
## Video Materials
93134

94135
The default properties of a material make the video look rather opaque for a screen, but you can enhance that by altering other properties of the material.
@@ -327,7 +368,7 @@ function mySystem() {
327368
}
328369
```
329370

330-
<!--
371+
<!--
331372
332373
## Map a video texture
333374
@@ -341,7 +382,7 @@ use uvs to map parts of the video
341382
342383
-->
343384

344-
<!--
385+
<!--
345386
## Handle a video file
346387
347388
When playing a video from a file, you can perform the following actions:
@@ -356,4 +397,3 @@ When playing a video from a file, you can perform the following actions:
356397
357398
You can also change the following properties:
358399
-->
359-

content/creator/worlds/about.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Worlds Overview"
3-
slug: "/contributor/worlds/about"
3+
url: /creator/worlds/about
44
weight: 1
55
---
66

content/creator/worlds/cast.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "Decentraland Cast"
3+
url: /creator/worlds/cast
4+
weight: 22
5+
---
6+
7+
Decentraland Cast is a specialized tool tailored for world owners and other authorized individuals. It offers the capability to stream camera footage or share screens seamlessly within their world.
8+
9+
## Streaming
10+
11+
At the moment, streaming via [Decentraland Cast](https://cast.decentraland.org) is an exclusive feature reserved for world owners and individuals who possess deployment rights. For more details on these rights, refer to the [ACL]({{< ref "/creator/worlds/about.md#access-control-lists-acl" >}}) section.
12+
13+
If authorized, users have the option to either activate their cameras or share their screens directly within the app.
14+
15+
A notable feature of the Decentraland Cast web application is its flawless integration with the world. This ensures that irrespective of whether you are connected via the world itself or the Cast app, communication remains uninterrupted. Users can effortlessly send, receive, and listen to chat and voice messages.
16+
17+
## Other users in the cast app
18+
19+
While users can readily join the Decentraland Cast application, those lacking streaming authorization will find their capabilities restricted. Specifically, they will not have permissions to broadcast any data, whether it be video, voice chat, or text messaging.
20+
21+
## Scene
22+
23+
A scene should be deployed in the world with the ability to handle video streams. To delve deeper into the specifics of this integration, please consult the [Decentraland SDK]({{< ref "/content/creator/sdk7/media/video-playing.md#streaming-using-decentraland-cast" >}}) documentation.

0 commit comments

Comments
 (0)