|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
<template> |
|
|
|
|
<v-container> |
|
|
|
|
<v-btn @click="deviceSelectDialog = true">change</v-btn> |
|
|
|
|
<v-dialog |
|
|
|
|
v-model="deviceSelectDialog" |
|
|
|
|
max-width="290" |
|
|
|
@ -17,6 +18,7 @@ |
|
|
|
|
item-value="deviceId" |
|
|
|
|
item-text="label" |
|
|
|
|
></v-select> |
|
|
|
|
<v-checkbox label="No Video" v-model="noVid"></v-checkbox> |
|
|
|
|
</v-col> |
|
|
|
|
<v-col md="12" cols="12"> |
|
|
|
|
<v-select |
|
|
|
@ -51,7 +53,6 @@ |
|
|
|
|
</v-card-actions> |
|
|
|
|
</v-card> |
|
|
|
|
</v-dialog> |
|
|
|
|
<v-btn @click="genRemoteFeed">Remote Feed</v-btn> |
|
|
|
|
<v-row> |
|
|
|
|
<v-col cols="12" md="3"> |
|
|
|
|
<video ref="ownstream" class="rounded centered" id="myvideo" width="100%" height="100%" autoplay |
|
|
|
@ -65,8 +66,6 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import RemoteFeed from "@/lib/RemoteFeed"; |
|
|
|
|
export default { |
|
|
|
|
components: {RemoteFeed}, |
|
|
|
@ -85,9 +84,11 @@ |
|
|
|
|
mypvtid: '', |
|
|
|
|
selectedVideo: null, |
|
|
|
|
selectedAudio: null, |
|
|
|
|
started: false, |
|
|
|
|
videoDevices: [], |
|
|
|
|
audioDevices: [], |
|
|
|
|
deviceSelectDialog: false, |
|
|
|
|
noVid: false, |
|
|
|
|
remoteStreams: [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -159,11 +160,8 @@ |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
janusMessage: function (msg, jsep) { |
|
|
|
|
// this.$janus.debug(" ::: Got a message (publisher) :::"); |
|
|
|
|
console.log(msg); |
|
|
|
|
// this.$janus.debug(jsep); |
|
|
|
|
var event = msg["videoroom"]; |
|
|
|
|
// this.$janus.debug("Event: " + event); |
|
|
|
|
if (event !== undefined) { |
|
|
|
|
if (event === "joined") { |
|
|
|
|
this.myid = msg["id"]; |
|
|
|
@ -174,7 +172,6 @@ |
|
|
|
|
this.controlPublishers(msg) |
|
|
|
|
} |
|
|
|
|
} else if(event === "event") { |
|
|
|
|
// Any new feed to attach to? |
|
|
|
|
if (msg["publishers"] !== undefined && msg["publishers"] !== null) { |
|
|
|
|
this.controlPublishers(msg) |
|
|
|
|
|
|
|
|
@ -193,15 +190,11 @@ |
|
|
|
|
this.pluginHandle.handleRemoteJsep({jsep: jsep}); |
|
|
|
|
var audio = msg["audio_codec"]; |
|
|
|
|
if (this.mystream && this.mystream.getAudioTracks() && this.mystream.getAudioTracks().length > 0 && !audio) { |
|
|
|
|
// Audio has been rejected |
|
|
|
|
//toastr.warning("Our audio stream has been rejected, viewers won't hear us"); |
|
|
|
|
console.log("Our audio stream has been rejected, viewers won't hear us"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onlocalstream: function (stream) { |
|
|
|
|
// this.$janus.debug(" ::: Got a local stream :::"); |
|
|
|
|
// this.$janus.debug(stream); |
|
|
|
|
this.mystream = stream |
|
|
|
|
console.log(this.$refs) |
|
|
|
|
console.log(this.$refs["ownstream"]) |
|
|
|
@ -212,7 +205,7 @@ |
|
|
|
|
this.deviceSelectDialog = false |
|
|
|
|
|
|
|
|
|
var media = { |
|
|
|
|
audioRecv: false, videoRecv: false, audioSend: true, videoSend: true, |
|
|
|
|
audioRecv: false, videoRecv: false, audioSend: true, videoSend: !this.noVid, |
|
|
|
|
audio: { |
|
|
|
|
deviceId: { |
|
|
|
|
exact: this.selectedAudio |
|
|
|
@ -244,14 +237,25 @@ |
|
|
|
|
mediaState: function (medium, on) { |
|
|
|
|
this.$janus.log("Janus " + (on ? "started" : "stopped") + " receiving our " + medium); |
|
|
|
|
}, |
|
|
|
|
changeDevice: function () { |
|
|
|
|
this.$refs.ownstream.setSinkId(this.selectedVideo) |
|
|
|
|
this.$refs.ownstream.setSinkId(this.selectedAudio) |
|
|
|
|
}, |
|
|
|
|
selectDevice: function () { |
|
|
|
|
console.log(this.selectedVideo) |
|
|
|
|
console.log(this.selectedAudio) |
|
|
|
|
// this.$refs.ownstream.setSinkId(this.selectedVideo) |
|
|
|
|
// this.$refs.ownstream.setSinkId(this.selectedAudio) |
|
|
|
|
|
|
|
|
|
var register = {"request": "join", "room": this.room, "ptype": "publisher", "display": this.username}; |
|
|
|
|
this.pluginHandle.send({"message": register}); |
|
|
|
|
if (!this.started) { |
|
|
|
|
console.log(this.selectedVideo) |
|
|
|
|
console.log(this.selectedAudio) |
|
|
|
|
this.started = true |
|
|
|
|
var register = { |
|
|
|
|
"request": "join", |
|
|
|
|
"room": this.room, |
|
|
|
|
"ptype": "publisher", |
|
|
|
|
"display": this.username |
|
|
|
|
}; |
|
|
|
|
this.pluginHandle.send({"message": register}); |
|
|
|
|
} else { |
|
|
|
|
this.restartDevices() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
janusSuccess: function () { |
|
|
|
|
this.opaqueId = "videoroomtest-" + this.$janus.randomString(12); |
|
|
|
|