Skip to content

Commit b088409

Browse files
committed
Update docs
1 parent 41877cc commit b088409

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

lib/live_ex_webrtc/player.ex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ defmodule LiveExWebRTC.Player do
1212
When `LiveExWebRTC.Publisher` is used, audio an video packets are delivered automatically,
1313
assuming both components are configured with the same PubSub.
1414
15-
If `LiveExWebRTC.Publisher` is not used, you should send packets to the
16-
`streams:audio:#{publisher_id}` and `streams:video:#{publisher_id}` topics.
17-
18-
Keyframe requests are sent under `publishers:#{publisher_id}` topic.
15+
If `LiveExWebRTC.Publisher` is not used, you need to send track information and packets,
16+
and receive keyframe requests manually using specific PubSub topics.
17+
See `LiveExWebRTC.Publisher` module doc for more.
1918
2019
## JavaScript Hook
2120
@@ -34,6 +33,11 @@ defmodule LiveExWebRTC.Player do
3433
});
3534
```
3635
36+
## Simulcast
37+
38+
Simulcast requires video codecs to be H264 (packetization mode 1) and/or VP8.
39+
See `LiveExWebRTC.Publisher` module doc for more.
40+
3741
## Examples
3842
3943
```elixir

lib/live_ex_webrtc/publisher.ex

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ defmodule LiveExWebRTC.Publisher do
1818
When `LiveExWebRTC.Player` is used, audio and video packets are delivered automatically,
1919
assuming both components are configured with the same PubSub.
2020
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.
2631
```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"})
2833
```
2934
3035
## JavaScript Hook
@@ -44,6 +49,31 @@ defmodule LiveExWebRTC.Publisher do
4449
});
4550
```
4651
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+
4777
## Examples
4878
4979
```elixir

0 commit comments

Comments
 (0)