Skip to content

Commit

Permalink
Update behviour of chat and stream reload
Browse files Browse the repository at this point in the history
  • Loading branch information
splattater committed Apr 17, 2024
1 parent 27014e4 commit 2265913
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
13 changes: 1 addition & 12 deletions live/stream.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,12 @@

<h1>DataWeek 2024 Live Stream</h1>

<div class="videoWrapper">
<div id="videoWrapper" class="videoWrapper">
<!--
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/3FmUIvFg8QM"
title="YouTube video player" frameborder="0" allow="accelerometer; autoplay;
clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
-->

<iframe
id="videoframe"
src="https://www.youtube-nocookie.com/embed/PGC6_xjmWeQ"
width="560"
height="315"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
</div>

<div id="stream_selection"></div>
Expand Down
18 changes: 13 additions & 5 deletions resources/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,19 @@ socket.on('server_message', (message) => {
});

function updateVideo(videoUrl) {
let currentUrl = document.getElementById('videoframe').getAttribute("src");
if (currentUrl != videoUrl) {
document.getElementById('videoframe').setAttribute("src", videoUrl);
}
let wrapper = document.getElementById('videoWrapper');
wrapper.innerHTML = `
<iframe
id="videoframe"
src="${videoUrl}"
width="560"
height="315"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
`
}

socket.on('streams_update', (streamList) => {
Expand All @@ -85,7 +94,6 @@ function zapp(stream_id) {
const message_box = document.getElementById('message-box');
message_box.innerHTML = '';
room_id = stream_id;
window.location.hash = "#" + room_id;
socket.emit('client_zapp', stream_id);
}

Expand Down

0 comments on commit 2265913

Please sign in to comment.