Skip to content

Commit

Permalink
Work with new video tag policy (no autoplay on page load unless muted).
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 27, 2019
1 parent fed8b6d commit 167b4ec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
</tr>
<tr>
<td></td>
<td><label for="subscribe"><input type="checkbox" id="subscribe"/>Subscribe</label></td>
<td><label for="subscribe"><input type="checkbox" id="subscribe"/>Subscribe</label>
<label for="muted"><input type="checkbox" id="muted" checked>Muted</label></label></td>
<td><label for="profLow"><input type="radio" name="prof" id="profLow" value="low" />Low</label></td>
</tr>
</table>
<div class="videoContainer">
<video id="subVideo" autoplay playsinline></video>
<video id="subVideo" autoplay playsinline muted></video>
</div>
</div>
<script type="text/javascript" src="mediasoup-client.js"></script>
Expand Down
14 changes: 14 additions & 0 deletions app/subscriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,18 @@ function subscriberLoad() {
}
onEnterPerform(subChannel, subscribeCheck);
onEnterPerform(subPassword, subscribeCheck);

function mutedToggle() {
video.muted = muted.checked;
}
muted.addEventListener('click', mutedToggle);

if (window.location.search.match(/(\?|&)sub=1(&|$)/)) {
// Autosubscribe.
subscribeCheck();
}
else {
// Unmute in preparation for subscribe toggle.
muted.checked = video.muted = false;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mediasoup-broadcast-example",
"version": "1.2.8",
"version": "1.2.9",
"description": "Sample WebRTC broadcast client/server for the Mediasoup SFU.",
"main": "server/index.js",
"scripts": {
Expand Down

0 comments on commit 167b4ec

Please sign in to comment.