Skip to content

Commit

Permalink
feat: Add butto to replace browser's url
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-banha committed Apr 29, 2024
1 parent 1a60b84 commit 7197fb5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions index.html
Expand Up @@ -28,6 +28,11 @@
container
</button>
</div>
<div class="m-2 button-group">
<button id="replace-url" type="button" class="btn btn-secondary btn-sm">
Replace url
</button>
</div>

<div class="row video-group">
<div class="col">
Expand Down
14 changes: 13 additions & 1 deletion shareTheScreen.js
Expand Up @@ -34,8 +34,20 @@ $("#resize-video-container").click(() => {
}
});

$("#replace-url").click(function () {
const browserUrl = new URL(window.location.toString());

if (browserUrl.searchParams.has("test-param")) {
browserUrl.searchParams.delete("test-param");
} else {
browserUrl.searchParams.append("test-param", Date.now().toString());
}

window.history.replaceState(null, "", browserUrl);
})

async function join() {
const captureStream = await navigator.mediaDevices.getDisplayMedia({
const captureStream = await navigator.mediaDevices.getUserMedia({
video: true,
audio: false,
});
Expand Down

0 comments on commit 7197fb5

Please sign in to comment.