Skip to content

Commit

Permalink
Merge branch 'master' into fix/start-with-screen-share
Browse files Browse the repository at this point in the history
  • Loading branch information
SelimEmre committed Mar 14, 2021
2 parents 74c4728 + 89904dd commit 1504e95
Show file tree
Hide file tree
Showing 37 changed files with 96,061 additions and 230 deletions.
8 changes: 1 addition & 7 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.antmedia</groupId>
<artifactId>parent</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.3.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>io.antmedia.webrtc</groupId>
Expand Down Expand Up @@ -231,12 +231,6 @@
<version>${jersey.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>${javacpp.ffmpeg.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Expand Up @@ -4,8 +4,6 @@
import java.util.List;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.bytedeco.ffmpeg.avcodec.AVPacket;
import org.bytedeco.ffmpeg.avformat.AVFormatContext;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.scope.IScope;
import org.red5.server.api.stream.IBroadcastStream;
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/360_live.html
Expand Up @@ -4,18 +4,18 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ant Media Server WebRTC/HLS 360 Live Player</title>

<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="js/external/aframe.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://rawgit.com/oscarmarinmiro/aframe-video-controls/master/dist/aframe-video-controls.min.js"></script>
<script src="js/external/hls.js"></script>
<script src="js/external/aframe-video-controls.min.js"></script>

<script src="js/fetch.js"></script>
<script src="js/promise.min.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="js/external/adapter-latest.js"></script>

<link href="css/player.css" rel="stylesheet">

<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="js/external/jquery-3.4.1.min.js"></script>
<script>
setTimeout(function(){
$(".a-enter-vr-button").click();
Expand Down
7 changes: 3 additions & 4 deletions src/main/webapp/audio_player.html
Expand Up @@ -4,10 +4,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
href="css/external/bootstrap3/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="js/external/adapter-latest.js"></script>
<style>
video {
width: 100%;
Expand Down
9 changes: 4 additions & 5 deletions src/main/webapp/audio_publish.html
Expand Up @@ -4,12 +4,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
href="css/external/bootstrap3/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="js/external/adapter-latest.js"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
src="js/external/jquery-3.4.1.min.js"></script>


<style>
Expand Down
123 changes: 69 additions & 54 deletions src/main/webapp/canvas-player.html
Expand Up @@ -4,31 +4,42 @@
<title>Ant Media Server WebRTC Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<link rel="stylesheet" href="css/external/bootstrap4/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="js/external/adapter-latest.js"></script>

<style>
iframe {
width: 107% !important;
height: 100% !important;
border: 0px !important;
background: transparent;
z-index: 1;
left: -43px;
top: 0;
position: absolute;
}

video {
position: relative;
left: 0;
right: 0;
top: 0;
width: 100%;
height: 550px;
/* If you want to fit canvas-designer and video to fit perfectly
You need to do two things.
First -> Make width 100% below
Second -> Follow the instructions on #canvas-designer
*/
width: 30%;
max-width: 640px;
height: auto;
z-index: 0;
}

#canvas-designer {
margin: 0px auto;
width: 100% !important;

border-color: black !important;
border: 0 solid black !important;
height: 500px;
/*
If you want to fit canvas-designer and video to fit perfectly
comment out height 500px below and enable below two lines
height: 100% !important;
position: absolute;
*/
top: 0;
}

/* Everything but the jumbotron gets side spacing for mobile first views */
.header, .marketing, .footer {
padding: 15px;
Expand Down Expand Up @@ -67,15 +78,7 @@
display:none;
}

#canvas-designer {
margin: 0px auto;
width: 100% !important;
height: 100% !important;
border-color: black !important;
border: 0 solid black !important;
position: absolute;
top: 0;
}

.jumbotron {
padding: 0;
overflow: hidden;
Expand Down Expand Up @@ -244,44 +247,53 @@ <h3 class="col text-muted">WebRTC Play</h3>
function sendData(data) {
try {
var iceState = webRTCAdaptor.iceConnectionState(streamId);
if (iceState != null && iceState != "failed" && iceState != "disconnected" && isDataChannelEnabled) {

if(data == "request"){
webRTCAdaptor.sendData($("#streamName").val(), "request");
}
else if (data == "clear"){
webRTCAdaptor.sendData($("#streamName").val(), "clear");
}
else{
webRTCAdaptor.sendData($("#streamName").val(), data);
}
if (iceState != null && iceState == "connected" && isDataChannelEnabled) {

webRTCAdaptor.sendData($("#streamName").val(),data);
}
else {
designer.undo('all');
alert("WebRTC Publishing is not active. Please click Start Publishing first or check your Data Channel option.")
alert("WebRTC playing is not active. Please click Start Playing first");
}
}
catch (exception) {
designer.undo('all');
console.error(exception);
alert("Message cannot be sent. Make sure you've enabled data channel on server web panel");
alert("Message cannot be sent. Make sure you've enabled data channel and choose the correct player distribution on server web panel");
}
}

function clearDraw() {
designer.clearCanvas();
sendData("clear");
}
function requestData() {
try {
var iceState = webRTCAdaptor.iceConnectionState(streamId);
if (iceState != null && iceState == "connected") {

function startPlaying() {
streamId = streamNameBox.value;
webRTCAdaptor.play(streamNameBox.value, token);
webRTCAdaptor.sendData($("#streamName").val(),"request");
}
else {
designer.undo('all');
alert("WebRTC playing is not active. Please click Start Playing first");
}
}

function stopPlaying() {
webRTCAdaptor.stop(streamId);
catch (exception) {
designer.undo('all');
console.error(exception);
alert("Message cannot be sent. Make sure you've enabled data channel and choose the correct player distribution on server web panel");
}
}

function startPlaying() {
streamId = streamNameBox.value;
webRTCAdaptor.play(streamNameBox.value, token);
}

function stopPlaying() {
webRTCAdaptor.stop(streamId);
}

function clearDraw() {
designer.clearCanvas();
}

var pc_config = {
'iceServers' : [ {
Expand Down Expand Up @@ -462,21 +474,18 @@ <h3 class="col text-muted">WebRTC Play</h3>
if (designer.pointsLength > 0) {
designer.undo('all');
}
sendData("request");
requestData();
}
}
else if (info == "data_received") {

if (obj.event.data == "request") {
designer.sync();
}
else if (obj.event.data == "clear") {
designer.clearCanvas();
if(obj.event.data == "request"){
designer.sync();
}
else {
else{
designer.syncData(JSON.parse(obj.event.data));
}
console.log(obj.event.data);
}
else if (info == "updated_stats") {
//obj is the PeerStats which has fields
Expand Down Expand Up @@ -576,6 +585,12 @@ <h3 class="col text-muted">WebRTC Play</h3>
+ " audio level: " + obj.audioLevel);}

else if (info == "pong") {
/*
var iceState = webRTCAdaptor.iceConnectionState(streamId);
if (iceState != null && iceState != "failed" && iceState != "disconnected") {
designer.sync();
}
*/
//ping/pong message are sent to and received from server to make the connection alive all the time
//It's especially useful when load balancer or firewalls close the websocket connection due to inactivity
}
Expand Down

0 comments on commit 1504e95

Please sign in to comment.