Skip to content
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

added player fix streamid error #389

Merged
merged 9 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-js-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- run: npm install --include=dev
- run: npm test
- run: npm run compile
- run: npm run codecov
- run: npm run codecov
2 changes: 0 additions & 2 deletions src/main/webapp/publish_webrtc_deep_ar_effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ <h3 class="col text-muted"><a href="samples.html">WebRTC Samples</a> > Publish D
</script>

</body>


</html>
33 changes: 26 additions & 7 deletions src/main/webapp/samples/publish_webrtc_deep_ar_effects_frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/deepar@4.0.3/js/deepar.js"></script>

<style>
video {
video ,iframe {
width: 100%;
max-width: 640px;
}
Expand Down Expand Up @@ -56,10 +56,14 @@
<div>

<div class="jumbotron">
<div class="col-sm-12 form-group">
<video id="localVideo" autoplay muted controls playsinline></video>
<div class="row">
<div class="col-md-6">
<iframe id="playerIframe" allow="camera;microphone;display-capture" class="embed-responsive-item"></iframe>
</div>
<div class="col-md-6">
<video id="localVideo" autoplay muted controls playsinline class="embed-responsive-item" width="240px"></video>
</div>
</div>

<div class="form-group col-sm-12 text-left">
<input type="text" class="form-control"
id="streamId" name="streamIdTextBox" placeholder="Type stream ID">
Expand Down Expand Up @@ -150,6 +154,10 @@
start_publish_button.addEventListener("click", startPublishing, false);
var stop_publish_button = document.getElementById("stop_publish_button");
stop_publish_button.addEventListener("click", stopPublishing, false);
var playerIframe = document.getElementById("playerIframe");
playerIframe.src = "../play.html?id="+streamId;

var localVideo = document.getElementById("localVideo");

document.getElementById("streamId").defaultValue = "Goofy"
var streamIdBox = document.getElementById("streamId");
Expand All @@ -160,6 +168,7 @@

function startPublishing() {
streamId = streamIdBox.value;
playerIframe.src = "../play.html?id="+streamId;
webRTCAdaptor.publish(streamId, token, subscriberId, subscriberCode, streamName, mainTrack);
}

Expand All @@ -177,10 +186,12 @@
OfferToReceiveAudio: false,
OfferToReceiveVideo: false
};

var mediaConstraints = {
video: true,
audio: true,
video: {
width: { ideal: 500 },
height: { ideal: 500 }
},
audio: true
};

var websocketURL = getWebSocketURL(location);
Expand Down Expand Up @@ -302,5 +313,13 @@
});
});
}
function resizeVideoAndIframe() {
playerIframe.setAttribute("width",localVideo.clientWidth);
playerIframe.setAttribute("height",localVideo.clientHeight);
}

localVideo.onloadedmetadata=()=>resizeVideoAndIframe();
window.addEventListener('resize', resizeVideoAndIframe);
resizeVideoAndIframe();
</script>
</html>