@@ -18,13 +18,18 @@ defmodule LiveExWebRTC.Publisher do
18
18
When `LiveExWebRTC.Player` is used, audio and video packets are delivered automatically,
19
19
assuming both components are configured with the same PubSub.
20
20
21
- If `LiveExWebRTC.Player` is not used, you should subscribe to `streams:audio:#{publisher_id}`
22
- and `streams:video:#{publisher_id}` topics.
23
-
24
- Keyframe requests should be sent on `publishers:#{publisher_id}` topic e.g.
25
-
21
+ If `LiveExWebRTC.Player` is not used, you should use following topics and messages:
22
+ * `streams:audio:#{publisher_id}:#{audio_track_id}` - for receiving audio packets
23
+ * `streams:video:#{publisher_id}:#{video_track_id}:#{layer}` - for receiving video packets.
24
+ The message is in form of `{:live_ex_webrtc, :video, "l" | "m" | "h", ExRTP.Packet.t()}` or
25
+ `{:live_ex_webrtc, :audio, ExRTP.Packet.t()}`
26
+ * `streams:info:#{publisher.id}"` - for receiving information about publisher tracks and their layers.
27
+ The message is in form of: `{:live_ex_webrtc, :info, audio_track :: ExWebRTC.MediaStreamTrack.t(), video_track :: ExWebRTC.MediaStreamTrack.t()}`.
28
+ * `publishers:#{publisher_id}` for sending keyframe request.
29
+ The message must be in form of `{:live_ex_webrtc, :keyframe_req, "l" | "m" | "h"}`
30
+ E.g.
26
31
```elixir
27
- PubSub.broadcast(LiveTwitch.PubSub, "publishers:my_publisher", {:live_ex_webrtc, :keyframe_req})
32
+ PubSub.broadcast(LiveTwitch.PubSub, "publishers:my_publisher", {:live_ex_webrtc, :keyframe_req, "h" })
28
33
```
29
34
30
35
## JavaScript Hook
@@ -44,6 +49,31 @@ defmodule LiveExWebRTC.Publisher do
44
49
});
45
50
```
46
51
52
+ ## Simulcast
53
+
54
+ Simulcast requires video codecs to be H264 (packetization mode 1) and/or VP8. E.g.
55
+
56
+ ```elixir
57
+ video_codecs = [
58
+ %RTPCodecParameters{
59
+ payload_type: 98,
60
+ mime_type: "video/H264",
61
+ clock_rate: 90_000,
62
+ sdp_fmtp_line: %FMTP{
63
+ pt: 98,
64
+ level_asymmetry_allowed: true,
65
+ packetization_mode: 1,
66
+ profile_level_id: 0x42E01F
67
+ }
68
+ },
69
+ %RTPCodecParameters{
70
+ payload_type: 96,
71
+ mime_type: "video/VP8",
72
+ clock_rate: 90_000
73
+ }
74
+ ]
75
+ ```
76
+
47
77
## Examples
48
78
49
79
```elixir
0 commit comments