This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REMOTE STREAMS UI | |
function addRemoteStreamMiniView(remoteStream){ | |
var streamId = remoteStream.getId(); | |
// append the remote stream template to #remote-streams | |
$('#remote-streams').append( | |
$('<div/>', {'id': streamId + '_container', 'class': 'remote-stream-container col'}).append( | |
$('<div/>', {'id': streamId + '_mute', 'class': 'mute-overlay'}).append( | |
$('<i/>', {'class': 'fas fa-microphone-slash'}) | |
), | |
$('<div/>', {'id': streamId + '_no-video', 'class': 'no-video-overlay text-center'}).append( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var containerId = '#' + streamId + '_container'; | |
$(containerId).dblclick(function() { | |
// play selected container as full screen - swap out current full screen stream | |
remoteStreams[mainStreamId].stop(); // stop the main video stream playback | |
addRemoteStreamMiniView(remoteStreams[mainStreamId]); // send the main video stream to a container | |
$(containerId).empty().remove(); // remove the stream's miniView container | |
remoteStreams[streamId].stop() // stop the container's video stream playback | |
remoteStreams[streamId].play('full-screen-video'); // play the remote stream as the full screen video | |
mainStreamId = streamId; // set the container stream id as the new main stream id | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove the remote-container when a user leaves the channel | |
client.on("peer-leave", function(evt) { | |
var streamId = evt.stream.getId(); // the the stream id | |
if(remoteStreams[streamId] != undefined) { | |
remoteStreams[streamId].stop(); // stop playing the feed | |
delete remoteStreams[streamId]; // remove stream from list | |
if (streamId == mainStreamId) { | |
var streamIds = Object.keys(remoteStreams); | |
var randomId = streamIds[Math.floor(Math.random()*streamIds.length)]; // select from the remaining streams | |
remoteStreams[randomId].stop(); // stop the stream's existing playback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple JS interface for Agora.io web SDK | |
// app / channel settings | |
var agoraAppId = " "; // Set your Agora App ID | |
var channelName = 'agora-web-docs-demo'; | |
// video profile settings | |
var cameraVideoProfile = '480_4'; // 640 × 480 @ 30fps & 750kbs | |
var screenVideoProfile = '480_2'; // 640 × 480 @ 30fps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void OnButtonClick() | |
{ | |
Debug.Log("Button Clicked: " + name); | |
// determin which button | |
if (name.CompareTo("JoinButton") == 0) | |
{ | |
// join chat | |
OnJoinButtonClicked(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnJoinChannelSuccess (string channelName, uint uid, int elapsed) | |
{ | |
Debug.Log("Successfully joined channel: " + channelName + " with id: " + uid); | |
} | |
private void OnUserJoined (uint uid, int elapsed) | |
{ | |
Debug.Log("New user has joined channel with id: " + uid); | |
// add remote stream to scene |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UNITY EXPORT COMPATIBLE | |
apply plugin: 'com.android.library' | |
repositories { | |
mavenCentral() | |
} | |
buildscript { | |
repositories { | |
mavenCentral() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EveryplaySettings : ScriptableObject | |
{ | |
public string clientId; | |
public string clientSecret; | |
public string redirectURI = "https://m.everyplay.com/auth"; | |
public bool iosSupportEnabled; | |
public bool tvosSupportEnabled; | |
public bool androidSupportEnabled; | |
public bool standaloneSupportEnabled; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using UnityEngine.SceneManagement; | |
using agora_gaming_rtc; | |
#if(UNITY_2018_3_OR_NEWER) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using agora_gaming_rtc; | |
public class LeaveHandler : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void OnEnable() |