Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ionorg/ion-sfu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.29
Choose a base ref
...
head repository: ionorg/ion-sfu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.30
Choose a head ref
  • 7 commits
  • 12 files changed
  • 5 contributors

Commits on Oct 24, 2020

  1. chore(deps): update module pion/webrtc/v3 to v3.0.0-beta.10 (#251)

    Generated by renovateBot
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Oct 24, 2020
    Copy the full SHA
    ed026f6 View commit details
  2. Remove the config assignment not being used (#253)

    The variable `config` was assigned, but being used. 
    In this example, as signaling process is being done via ion-sfu server, the `config` seems to serve no purpose.
    
    By the way, thank you for writing such an on-point and easy-reading example. 
    This one helped me a lot.
    JonghunBok authored Oct 24, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    78971a9 View commit details
  3. chore(deps): update module google.golang.org/grpc to v1.33.1 (#240)

    Generated by renovateBot
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Oct 24, 2020
    Copy the full SHA
    8c61743 View commit details
  4. Update README.md

    tarrencev authored Oct 24, 2020
    Copy the full SHA
    ee72b7d View commit details

Commits on Oct 25, 2020

  1. fix(sender): start senders after answer is received (#255)

    * fix(sender): start senders after answer is received
    
    * remove add sender sleep
    
    * sdp/v3
    tarrencev authored Oct 25, 2020
    Copy the full SHA
    8d33681 View commit details

Commits on Oct 26, 2020

  1. chore: cleanup examples

    tarrencev committed Oct 26, 2020
    Copy the full SHA
    b83f63c View commit details
  2. Copy the full SHA
    4f2363b View commit details
Showing with 524 additions and 89 deletions.
  1. +1 −1 README.md
  2. +1 −9 examples/echotest/index.html
  3. +2 −28 examples/pubsubtest/index.html
  4. +153 −0 examples/racetest/sdk.html
  5. +264 −0 examples/racetest/vanilla.html
  6. +4 −4 go.mod
  7. +6 −15 go.sum
  8. +1 −9 pkg/router.go
  9. +2 −0 pkg/sender.go
  10. +19 −11 pkg/simplesender.go
  11. +18 −10 pkg/simulcastsender.go
  12. +53 −2 pkg/webrtctransport.go
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ go build ./cmd/signal/json-rpc/main.go && ./main -c config.toml
If you prefer a containerized environment, you can use the included Docker image

```
docker run -p 50051:50051 -p 5000-5020:5000-5020/udp pionwebrtc/ion-sfu:latest-jsonrpc
docker run -p 7000:7000 -p 5000-5020:5000-5020/udp pionwebrtc/ion-sfu:latest-jsonrpc
```

### Running the grpc signaling server
10 changes: 1 addition & 9 deletions examples/echotest/index.html
Original file line number Diff line number Diff line change
@@ -281,7 +281,7 @@ <h3>Pion</h3>
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"
></script>
<script src="https://unpkg.com/ion-sdk-js@1.0.2/dist/ion-sdk.min.js"></script>
<script src="https://unpkg.com/ion-sdk-js@1.0.17/dist/ion-sdk.min.js"></script>
<script>
const localVideo = document.getElementById("local-video");
const remoteVideo = document.getElementById("remote-video");
@@ -300,14 +300,6 @@ <h3>Pion</h3>
/* eslint-env browser */
const joinBtns = document.getElementById("start-btns");

const config = {
iceServers: [
{
urls: "stun:stun.l.google.com:19302",
},
],
};

const signalLocal = new IonSDK.IonSFUJSONRPCSignal(
"ws://localhost:7000/ws"
);
30 changes: 2 additions & 28 deletions examples/pubsubtest/index.html
Original file line number Diff line number Diff line change
@@ -17,38 +17,12 @@
/>

<style>
pre {
outline: 1px solid #ccc;
padding: 5px;
margin: 5px;
}

.string {
color: green;
}

.number {
color: darkorange;
}

.boolean {
color: blue;
}

.null {
color: magenta;
}

.key {
color: red;
}

#remotes video {
width: 320px;
}
</style>

<title>Pion ion-sfu | Echotest</title>
<title>Pion ion-sfu | Pubsubtest</title>
</head>

<body>
@@ -160,7 +134,7 @@ <h3>Pion</h3>
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"
></script>
<script src="https://unpkg.com/ion-sdk-js@1.0.2/dist/ion-sdk.min.js"></script>
<script src="https://unpkg.com/ion-sdk-js@1.0.17/dist/ion-sdk.min.js"></script>
<script>
const localVideo = document.getElementById("local-video");
const remotesDiv = document.getElementById("remotes");
153 changes: 153 additions & 0 deletions examples/racetest/sdk.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

<!-- Bootstrap CSS -->
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"
crossorigin="anonymous"
/>

<style>
#remotes video {
width: 160px;
}
</style>

<title>Pion ion-sfu | Racetest</title>
</head>

<body>
<nav class="navbar navbar-light bg-light border-bottom">
<h3>Pion</h3>
</nav>
<div class="container pt-4">
<div class="row">
<div class="col-12" id="join-btn">
<button type="button" class="btn btn-primary" onclick="join()">
Join
</button>
</div>
<div class="col-12" style="display: none" id="publish-btn">
<button type="button" class="btn btn-primary" onclick="publish()">
Publish
</button>
<button type="button" class="btn btn-primary" onclick="unpublish()">
Unpublish
</button>
</div>
</div>

<div class="row">
<div id="remotes" class="col-12 pt-2">
<span
style="position: absolute; margin-left: 5px; margin-top: 5px"
class="badge badge-primary"
>Remotes</span
>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"
></script>
<script src="https://unpkg.com/ion-sdk-js@1.0.17/dist/ion-sdk.min.js"></script>
<script>
const localVideo = document.getElementById("local-video");
const remotesDiv = document.getElementById("remotes");

/* eslint-env browser */
const joinBtn = document.getElementById("join-btn");
const publishBtn = document.getElementById("publish-btn");

const config = {
iceServers: [
{
urls: "stun:stun.l.google.com:19302",
},
],
};

class Peer {
constructor() {
this.signal = new IonSDK.IonSFUJSONRPCSignal(
"ws://localhost:7000/ws"
);

const videosDiv = document.createElement("div");
videosDiv.style.display = "flex";
remotesDiv.appendChild(videosDiv);

this.client = new IonSDK.Client("test session", this.signal);
this.client.ontrack = (track, stream) => {
if (track.kind === "video") {
const remoteVideo = document.createElement("video");
remoteVideo.srcObject = stream;
remoteVideo.autoplay = true;
remoteVideo.muted = true;
videosDiv.appendChild(remoteVideo);

track.onremovetrack = () => videosDiv.removeChild(removeVideo);
}
};
}

capture() {
IonSDK.LocalStream.getUserMedia({
resolution: "hd",
audio: true,
})
.then((media) => {
this.media = media;
})
.catch(console.error);
}

publish() {
this.client.publish(this.media);
}

unpublish() {
this.media.unpublish();
}
}

const peers = [];
const join = () => {
joinBtn.style.display = "none";
publishBtn.style.display = "block";

for (var i = 0; i < 3; i++) {
const peer = new Peer();
peer.capture();
peers.push(peer);
}
};

const publish = () => peers.forEach((peer) => peer.publish());
const unpublish = () => peers.forEach((peer) => peer.unpublish());
</script>
</body>
</html>
Loading