-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for simulcast #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
7efebc9
Add support for simulcast
mickel8 11e4267
Fix keyframe requests for non-simulcast tracks
mickel8 a1e3818
Rewrite details to casual divs
mickel8 162ec98
Add simulcast form
mickel8 c13b233
Fix div hidding
mickel8 6bccc84
Improve simulcast checkbox
mickel8 6c178c8
Rewrite simulcast checkbox so it's not inside a form
mickel8 1ef680d
Final final fix for the checkbox! - don't use phoenix's core componen…
mickel8 d750283
Accept vp8 for simulcast. Send media only if tracks were negotiated
mickel8 36ac644
Propagate info about available layers
mickel8 7e72442
Add initial version of settings overlay
mickel8 db02ef6
Restart connection on tracks change
mickel8 0061cb8
Dynamically determinae number of available layers
mickel8 b218632
Merge remote-tracking branch 'origin/master' into simulcast
mickel8 41877cc
Fixes after merge
mickel8 b088409
Update docs
mickel8 316331d
Make simulcast requirement more restrictive
mickel8 a22a11b
Remove nerd stats
mickel8 af752d5
Minor fixes - add rid to the on_packet callback, don't duplicate stre…
mickel8 4bf7fab
Fix recording
mickel8 38b5522
Set default FPS value to 30
mickel8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Used by "mix format" | ||
[ | ||
import_deps: [:phoenix], | ||
plugins: [Phoenix.LiveView.HTMLFormatter], | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,46 @@ | ||
export function createPlayerHook(iceServers = []) { | ||
return { | ||
async mounted() { | ||
this.pc = new RTCPeerConnection({ iceServers: iceServers }); | ||
const view = this; | ||
|
||
this.pc.onicecandidate = (ev) => { | ||
this.pushEventTo(this.el, "ice", JSON.stringify(ev.candidate)); | ||
}; | ||
view.handleEvent( | ||
`connect-${view.el.id}`, | ||
async () => await view.connect(view) | ||
); | ||
|
||
this.pc.ontrack = (ev) => { | ||
if (!this.el.srcObject) { | ||
this.el.srcObject = ev.streams[0]; | ||
const eventName = "answer" + "-" + view.el.id; | ||
view.handleEvent(eventName, async (answer) => { | ||
if (view.pc) { | ||
await view.pc.setRemoteDescription(answer); | ||
} | ||
}); | ||
|
||
view.videoQuality = document.getElementById("lexp-video-quality"); | ||
view.videoQuality.onchange = () => { | ||
view.pushEventTo(view.el, "layer", view.videoQuality.value); | ||
}; | ||
this.pc.addTransceiver("audio", { direction: "recvonly" }); | ||
this.pc.addTransceiver("video", { direction: "recvonly" }); | ||
}, | ||
|
||
const offer = await this.pc.createOffer(); | ||
await this.pc.setLocalDescription(offer); | ||
async connect(view) { | ||
view.el.srcObject = undefined; | ||
view.pc = new RTCPeerConnection({ iceServers: iceServers }); | ||
|
||
const eventName = "answer" + "-" + this.el.id; | ||
this.handleEvent(eventName, async (answer) => { | ||
await this.pc.setRemoteDescription(answer); | ||
}); | ||
view.pc.onicecandidate = (ev) => { | ||
view.pushEventTo(view.el, "ice", JSON.stringify(ev.candidate)); | ||
}; | ||
|
||
this.pushEventTo(this.el, "offer", offer); | ||
}, | ||
view.pc.ontrack = (ev) => { | ||
if (!view.el.srcObject) { | ||
view.el.srcObject = ev.streams[0]; | ||
} | ||
}; | ||
view.pc.addTransceiver("audio", { direction: "recvonly" }); | ||
view.pc.addTransceiver("video", { direction: "recvonly" }); | ||
|
||
const offer = await view.pc.createOffer(); | ||
await view.pc.setLocalDescription(offer); | ||
|
||
view.pushEventTo(view.el, "offer", offer); | ||
} | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀