Compare commits

..

3 Commits

  1. 69
      package-lock.json
  2. 10
      package.json
  3. 2
      public/index.html
  4. 96
      src/App.vue
  5. 21
      src/lib/PdfShare.vue
  6. 5
      src/lib/RemoteFeed.vue
  7. 47
      src/lib/VueJanus.vue
  8. 6
      src/main.js
  9. 2
      src/plugins/axios.js
  10. 34
      src/router/index.js
  11. 17
      src/store/index.js
  12. 19
      src/views/Home.vue
  13. 83
      src/views/Room.vue
  14. 59
      src/views/RoomView.vue
  15. 51
      src/views/login.vue

69
package-lock.json generated

@ -1273,47 +1273,18 @@
} }
}, },
"@vue/cli-plugin-router": { "@vue/cli-plugin-router": {
"version": "4.3.1", "version": "4.2.3",
"resolved": "https://registry.npm.taobao.org/@vue/cli-plugin-router/download/@vue/cli-plugin-router-4.3.1.tgz", "resolved": "https://registry.npmjs.org/@vue/cli-plugin-router/-/cli-plugin-router-4.2.3.tgz",
"integrity": "sha1-C6WJ9Omh8+ZKj/bM2S984oRVhr8=", "integrity": "sha512-RGtgFQCTMS1X1wtFt752RMgr/LlF9cfpH37MkwjhF2wpnyTp+hkKl/09QORAKW91I8iFpZFH7xZKMBS3r1WbCw==",
"dev": true,
"requires": {
"@vue/cli-shared-utils": "^4.3.1"
},
"dependencies": {
"@vue/cli-shared-utils": {
"version": "4.3.1",
"resolved": "https://registry.npm.taobao.org/@vue/cli-shared-utils/download/@vue/cli-shared-utils-4.3.1.tgz",
"integrity": "sha1-p0v01Tgl1KSwWoSwPgI5dIcbw4o=",
"dev": true, "dev": true,
"requires": { "requires": {
"@hapi/joi": "^15.0.1", "@vue/cli-shared-utils": "^4.2.3"
"chalk": "^2.4.2",
"execa": "^1.0.0",
"launch-editor": "^2.2.1",
"lru-cache": "^5.1.1",
"node-ipc": "^9.1.1",
"open": "^6.3.0",
"ora": "^3.4.0",
"read-pkg": "^5.1.1",
"request": "^2.88.2",
"request-promise-native": "^1.0.8",
"semver": "^6.1.0",
"strip-ansi": "^6.0.0"
}
},
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586534511518&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
} }
}, },
"@vue/cli-plugin-vuex": { "@vue/cli-plugin-vuex": {
"version": "4.3.1", "version": "4.2.3",
"resolved": "https://registry.npm.taobao.org/@vue/cli-plugin-vuex/download/@vue/cli-plugin-vuex-4.3.1.tgz", "resolved": "https://registry.npmjs.org/@vue/cli-plugin-vuex/-/cli-plugin-vuex-4.2.3.tgz",
"integrity": "sha1-K3Ov9W+eG+MQGIc9XtLVnxVedHY=", "integrity": "sha512-7M4CaoAD4W/GdiDI4+Gh2tATPFBnb/u7bCiLLDsuL9ztypv7l3p4cu43zkDpTCCuufkZFYtZwysOAY8SbGqOjg==",
"dev": true "dev": true
}, },
"@vue/cli-service": { "@vue/cli-service": {
@ -2384,6 +2355,11 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true "dev": true
}, },
"bootstrap": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.5.1.tgz",
"integrity": "sha512-bxUooHBSbvefnIZfjD0LE8nfdPKrtiFy2sgrxQwUZ0UpFzpjVbVMUxaGIoo9XWT4B2LG1HX6UQg0UMOakT0prQ=="
},
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@ -6928,9 +6904,9 @@
} }
}, },
"jquery": { "jquery": {
"version": "3.4.1", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
}, },
"js-message": { "js-message": {
"version": "1.0.5", "version": "1.0.5",
@ -8419,6 +8395,11 @@
"ts-pnp": "^1.1.6" "ts-pnp": "^1.1.6"
} }
}, },
"popper.js": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ=="
},
"portfinder": { "portfinder": {
"version": "1.0.25", "version": "1.0.25",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.25.tgz", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.25.tgz",
@ -11319,11 +11300,6 @@
} }
} }
}, },
"vue-router": {
"version": "3.1.6",
"resolved": "https://registry.npm.taobao.org/vue-router/download/vue-router-3.1.6.tgz?cache=0&sync_timestamp=1586343646335&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-3.1.6.tgz",
"integrity": "sha1-RfWjo4Q+MXAsBh3YKTk1VOQyj4k="
},
"vue-style-loader": { "vue-style-loader": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",
@ -11372,11 +11348,6 @@
"loader-utils": "^1.2.0" "loader-utils": "^1.2.0"
} }
}, },
"vuex": {
"version": "3.1.3",
"resolved": "https://registry.npm.taobao.org/vuex/download/vuex-3.1.3.tgz?cache=0&sync_timestamp=1584268708627&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvuex%2Fdownload%2Fvuex-3.1.3.tgz",
"integrity": "sha1-8q1z4/tzaRaYs4yT9m5Y4meUcYA="
},
"watchpack": { "watchpack": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",

@ -1,5 +1,5 @@
{ {
"name": "oydconf", "name": "albatross",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -8,20 +8,18 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^4.5.1",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"jquery": "^3.4.1", "jquery": "^3.5.1",
"pdfjs-dist": "^2.3.200", "pdfjs-dist": "^2.3.200",
"popper.js": "^1.16.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.1.6",
"vuetify": "^2.2.11", "vuetify": "^2.2.11",
"vuex": "^3.1.3",
"webrtc-adapter": "^7.5.1" "webrtc-adapter": "^7.5.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.2.0", "@vue/cli-plugin-babel": "~4.2.0",
"@vue/cli-plugin-eslint": "~4.2.0", "@vue/cli-plugin-eslint": "~4.2.0",
"@vue/cli-plugin-router": "^4.3.1",
"@vue/cli-plugin-vuex": "^4.3.1",
"@vue/cli-service": "~4.2.0", "@vue/cli-service": "~4.2.0",
"axios": "^0.18.0", "axios": "^0.18.0",
"babel-eslint": "^10.0.3", "babel-eslint": "^10.0.3",

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title> <title>Albatross</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head> </head>

@ -1,7 +1,97 @@
<template> <template>
<v-app> <v-app>
<v-content> <v-app-bar
<router-view></router-view> app
</v-content></v-app> color="#ab0000"
dark
>
<v-toolbar-title>Albatross</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon>
<v-icon>mdi-help</v-icon>
</v-btn>
</v-app-bar>
<v-container
class="fill-height"
fluid
>
<v-row
align="center"
justify="center"
v-if="!start"
>
<v-col
cols="12"
sm="8"
md="4"
>
<v-card class="elevation-12" >
<v-toolbar
color="#ab0000"
dark
flat
>
<v-toolbar-title>Login</v-toolbar-title>
<v-spacer></v-spacer>
<v-tooltip bottom>
<span>Source</span>
</v-tooltip>
</v-toolbar>
<v-card-text>
<v-form>
<v-text-field v-if="!start" v-model="username" label="Please enter your name"></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="#ab0000" v-if="!start" @click="startM">Start</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
<VueJanus v-if="start" server="https://vid.w3ic.org/janus" :room="room" :username="username"/>
</v-container>
<v-footer
color="#ffffff"
app
>
<v-col
class="text-center"
cols="12"
>
<strong>Özgür Yazılım Derneği</strong>
</v-col>
</v-footer>
</v-app>
</template> </template>
<script>
import VueJanus from "@/lib/VueJanus";
export default {
name: 'App',
components: {
VueJanus
},
data: () => ({
test: ' ',
room:1234,
username: '',
start:false
}),
mounted () {
},
methods: {
startM () {
if (this.username) {
this.start = true
}
}
}
};
</script>

@ -1,6 +1,6 @@
<template> <template>
<div style="position: absolute;right: 0;bottom:0;width: 400px;border:1px solid #ccc"> <v-card class="d-inline-block mx-auto d-flex flex-row-reverse" v-if="show">
<v-container>
<v-row> <v-row>
<v-col cols="12" md="10"> <v-col cols="12" md="10">
<v-file-input ref="file" id="myfile" accept="pdf" label="Please select a file"></v-file-input> <v-file-input ref="file" id="myfile" accept="pdf" label="Please select a file"></v-file-input>
@ -20,7 +20,8 @@
<v-btn v-if="pdf && !loading" @click="stop">stop pdf share</v-btn> <v-btn v-if="pdf && !loading" @click="stop">stop pdf share</v-btn>
</v-col> </v-col>
</v-row> </v-row>
</div> </v-container>
</v-card>
</template> </template>
<script> <script>
@ -43,10 +44,12 @@ export default {
opaqueId:String opaqueId:String
}, },
data: () => ({ data: () => ({
show: true,
pdf: null, pdf: null,
pageNumber: 1, pageNumber: 1,
loading: true, loading: true,
pluginHandle: null pluginHandle: null,
intervalId: null
}), }),
mounted () { mounted () {
pdfjsLib.GlobalWorkerOptions.workerSrc = "/pdf.worker.js" pdfjsLib.GlobalWorkerOptions.workerSrc = "/pdf.worker.js"
@ -73,8 +76,9 @@ export default {
var renderTask = page.render(renderContext); var renderTask = page.render(renderContext);
renderTask.promise.then( () => { renderTask.promise.then( () => {
if (!this.pluginHandle) {
this.loading = false this.loading = false
if (!this.pluginHandle) {
// document.getElementById('pdfvid').srcObject = document.getElementById('mypdfview').captureStream(60) // document.getElementById('pdfvid').srcObject = document.getElementById('mypdfview').captureStream(60)
this.janusInit.attach( this.janusInit.attach(
@ -102,19 +106,22 @@ export default {
}, },
stop(){ stop(){
this.onstop();
var unpublish = { "request": "unpublish"}; var unpublish = { "request": "unpublish"};
this.pluginHandle.send({"message": unpublish}); this.pluginHandle.send({"message": unpublish});
this.pluginHandle.detach(); this.pluginHandle.detach();
// reset // reset
clearInterval(this.intervalId);
this.pluginHandle = null; this.pluginHandle = null;
this.pdf = null; this.pdf = null;
this.pageNumber = 1; this.pageNumber = 1;
this.loading = true; this.loading = true;
// callback // callback
this.onstop();
}, },
janusPluginError (error) { janusPluginError (error) {
console.log('error', error) console.log('error', error)
@ -208,7 +215,7 @@ export default {
// var pageNumber = 1; // var pageNumber = 1;
this.pdf = pdf this.pdf = pdf
this.loading = true this.loading = true
setInterval(this.pdfTimer, 1000/15) this.intervalId = setInterval(this.pdfTimer, 1000/15)
this.renderPage(1) this.renderPage(1)

@ -1,6 +1,5 @@
<template> <template>
<v-card max-height="150" height="150" dark <v-card max-height="150" height="150" dark
:color="remoteStream.talking?'green':''"
class="vid_main" @mouseleave="showaction = false" @mouseover="showaction = true"> class="vid_main" @mouseleave="showaction = false" @mouseover="showaction = true">
<video ref="feed_video" class="vid_container" autoplay playsinline/> <video ref="feed_video" class="vid_container" autoplay playsinline/>
<div class="infor">{{ bitrate }}</div> <div class="infor">{{ bitrate }}</div>
@ -88,7 +87,6 @@
this.$refs.feed_video.src = URL.createObjectURL(stream) this.$refs.feed_video.src = URL.createObjectURL(stream)
} }
this.$refs
} else { } else {
console.log(this.$refs.feed_video) console.log(this.$refs.feed_video)
} }
@ -98,7 +96,6 @@
this.bitrate = this.remoteFeed.getBitrate() this.bitrate = this.remoteFeed.getBitrate()
}, },
feedResponse (jsep) { feedResponse (jsep) {
console.log(jsep)
var body = { "request": "start", "room": this.room } var body = { "request": "start", "room": this.room }
this.remoteFeed.send({"message": body, "jsep": jsep}) this.remoteFeed.send({"message": body, "jsep": jsep})
}, },
@ -111,6 +108,7 @@
if (msg["janus"]) { if (msg["janus"]) {
console.log("######################") console.log("######################")
console.log("nn",msg) console.log("nn",msg)
} }
console.log("-------------------------") console.log("-------------------------")
var event = msg["videoroom"]; var event = msg["videoroom"];
@ -119,6 +117,7 @@
} else if(event !== undefined && event != null) { } else if(event !== undefined && event != null) {
this.remoteFeed.rfid = msg["id"] this.remoteFeed.rfid = msg["id"]
this.remoteFeed.rfdisplay = msg["display"] this.remoteFeed.rfdisplay = msg["display"]
} else if(event === "event") { } else if(event === "event") {
var substream = msg["substream"] var substream = msg["substream"]
var temporal = msg["temporal"] var temporal = msg["temporal"]

@ -1,6 +1,6 @@
<template> <template>
<v-container fill-height> <v-container fill-height>
<PdfShare v-if="sharePdf" :username="username" :opaque-id="opaqueId" :room="room" :janus-init="janusInit" ></PdfShare> <PdfShare v-if="sharePdf" :username="username" :opaque-id="opaqueId" :room="room" :onstop="stopSharePdf" :janus-init="janusInit" ></PdfShare>
<v-dialog <v-dialog
v-model="mozillaAlert" v-model="mozillaAlert"
max-width="600" max-width="600"
@ -72,7 +72,7 @@
text text
@click="deviceSelectDialog = false" @click="deviceSelectDialog = false"
> >
Disagree Cancel
</v-btn> </v-btn>
<v-btn <v-btn
@ -80,7 +80,7 @@
text text
@click="selectDevice" @click="selectDevice"
> >
Agree OK
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
@ -88,19 +88,15 @@
<v-row> <v-row>
<v-col cols="12" md="2"> <v-col cols="12" md="2">
<div width="100%" height="100%" style="position: relative">
<video ref="ownstream" class="rounded centered" id="myvideo" width="100%" height="100%" autoplay <video ref="ownstream" class="rounded centered" id="myvideo" width="100%" height="100%" autoplay
playsinline muted="muted"/> playsinline muted="muted"/>
<v-btn icon v-if="ownmuted" @click="muteMe"><v-icon>mdi-volume-mute</v-icon></v-btn>
<v-btn icon v-if="!ownmuted" @click="muteMe"><v-icon>mdi-volume-high</v-icon></v-btn>
</div>
</v-col> </v-col>
<v-col cols="12" md="2" style="display: none"> <v-col cols="12" md="2" style="display: none">
<video ref="ownstreamscreen" class="rounded centered" id="myvideo2" width="100%" height="100%" autoplay <video ref="ownstreamscreen" class="rounded centered" id="myvideo2" width="100%" height="100%" autoplay
playsinline muted="muted"/> playsinline muted="muted"/>
</v-col> </v-col>
<v-col cols="12" md="2" v-for="remoteStream in remoteStreams" :key="remoteStream.id"> <v-col cols="12" md="2" v-for="remoteStream in remoteStreams" :key="remoteStream.id">
<RemoteFeed @kick="kickUser" :creator="creator" :talking="remoteStream.talking" :opaqueId="opaqueId" :mypvtid="mypvtid" :feedid="remoteStream.id" :remote-stream="remoteStream" :janusInit="janusInit" :room="room" ></RemoteFeed> <RemoteFeed :opaqueId="opaqueId" :mypvtid="mypvtid" :feedid="remoteStream.id" :remote-stream="remoteStream" :janusInit="janusInit" :room="room" ></RemoteFeed>
</v-col> </v-col>
</v-row> </v-row>
<v-speed-dial <v-speed-dial
@ -199,8 +195,7 @@
props: { props: {
server: String, server: String,
room: Number, room: Number,
username: String, username: String
creator: Boolean
}, },
data() { data() {
return { return {
@ -209,7 +204,6 @@
pluginHandle: null, pluginHandle: null,
mystream: null, mystream: null,
myid: '', myid: '',
ownmuted: false,
mypvtid: '', mypvtid: '',
selectedVideo: null, selectedVideo: null,
selectedAudio: null, selectedAudio: null,
@ -245,24 +239,11 @@
}, },
methods: { methods: {
kickUser (user) {
this.$emit('kick',user)
},
muteMe () {
this.ownmuted = !this.ownmuted
if(!this.ownmuted) {
this.pluginHandle.unmuteAudio()
} else {
this.pluginHandle.muteAudio()
}
},
stopSharePdf(){ stopSharePdf(){
this.sharePdf=false; this.sharePdf=false;
}, },
webrtcState (on) { webrtcState (on) {
this.pluginHandle.send({"message": { "request": "configure", "bitrate": 128*1000 }}); this.pluginHandle.send({"message": { "request": "configure", "bitrate": 512*1000 }});
console.log(on, "webrt") console.log(on, "webrt")
}, },
janusPluginSuccessScreen (pluginHandle) { janusPluginSuccessScreen (pluginHandle) {
@ -367,6 +348,7 @@
this.$janus.listDevices(this.initDevices); this.$janus.listDevices(this.initDevices);
}, },
initDevices (devices) { initDevices (devices) {
console.log(devices) console.log(devices)
@ -388,14 +370,13 @@
}, },
offerSend (jsep) { offerSend (jsep) {
console.log('vid offer') console.log('vid offer')
console.log(jsep)
var publish = {"request": "configure", "audio": true, "video": true}; var publish = {"request": "configure", "audio": true, "video": true};
this.pluginHandle.send({"message": publish, "jsep": jsep}); this.pluginHandle.send({"message": publish, "jsep": jsep});
}, },
controlPublishers(msg) { controlPublishers(msg) {
msg["publishers"].forEach(item => { msg["publishers"].forEach(item => {
var has = false var has = false
item.talking = false
this.remoteStreams.forEach(rm => { this.remoteStreams.forEach(rm => {
if (item.id === rm.id) has = true if (item.id === rm.id) has = true
}) })
@ -408,19 +389,7 @@
janusMessage (msg, jsep) { janusMessage (msg, jsep) {
console.log(msg); console.log(msg);
var event = msg["videoroom"]; var event = msg["videoroom"];
if (event !== undefined) { if (event !== undefined) {
if (event === "talking") {
this.remoteStreams.forEach(item => {
if (item.id === msg['id']) item.talking = true
})
}
if (event === "stopped-talking") {
this.remoteStreams.forEach(item => {
if (item.id === msg['id']) item.talking = false
})
}
if (event === "joined") { if (event === "joined") {
this.myid = msg["id"]; this.myid = msg["id"];
this.mypvtid = msg["private_id"]; this.mypvtid = msg["private_id"];

@ -3,15 +3,11 @@ import './plugins/axios'
import JanusPlugin from "@/plugins/janus" import JanusPlugin from "@/plugins/janus"
import App from './App.vue' import App from './App.vue'
import vuetify from './plugins/vuetify'; import vuetify from './plugins/vuetify';
import router from './router'
import store from './store'
Vue.config.productionTip = false Vue.config.productionTip = false
console.log("janus is installed", Vue.$janus)
new Vue({ new Vue({
vuetify, vuetify,
JanusPlugin, JanusPlugin,
router,
store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')

@ -9,7 +9,7 @@ import axios from "axios";
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
let config = { let config = {
baseURL: process.env.baseURL || process.env.apiUrl || "http://localhost:5000/api/" // baseURL: process.env.baseURL || process.env.apiUrl || ""
// timeout: 60 * 1000, // Timeout // timeout: 60 * 1000, // Timeout
// withCredentials: true, // Check cross-site Access-Control // withCredentials: true, // Check cross-site Access-Control
}; };

@ -1,34 +0,0 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/login',
name: 'login',
component: () => import(/* webpackChunkName: "login" */ '../views/login.vue')
}, {
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "Home" */ '../views/Home.vue')
},
{
path: '/rooms',
name: 'Room',
component: () => import(/* webpackChunkName: "Room" */ '../views/Room.vue')
},
{
path: '/room/:id',
name: 'RoomView',
component: () => import(/* webpackChunkName: "RoomView" */ '../views/RoomView.vue')
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router

@ -1,17 +0,0 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
token: null,
name: 'None'
},
mutations: {
},
actions: {
},
modules: {
}
})

@ -1,19 +0,0 @@
<template>
<v-container>
<v-text-field v-model="room" label="Enter Room Name"></v-text-field> <v-btn @click="$router.push('/room/' + this.room)">Enter Room</v-btn><br />
<v-btn x-small @click="$router.push('/login')" text>login with user</v-btn>
</v-container>
</template>
<script>
export default {
name: "Home",
data: () => ({
room: null
})
}
</script>
<style scoped>
</style>

@ -1,83 +0,0 @@
<template>
<v-container>
<v-dialog
v-model="createDialog"
max-width="290"
>
<v-card>
<v-card-title>
<v-row>
<v-col cols="12"><v-text-field v-model="roomCreate.room_name" placeholder="name"></v-text-field></v-col>
<v-col cols="12"><v-text-field v-model="roomCreate.publisher_count" placeholder="Room Publisher Count"></v-text-field></v-col>
<v-col cols="12"><v-select label="Video Codec" v-model="roomCreate.video_codec" :items="vcodecs"></v-select></v-col>
<v-col cols="12"><v-select label="Audio Codec" v-model="roomCreate.audio_codec" :items="acodecs"></v-select></v-col>
</v-row>
</v-card-title>
<v-card-actions>
<v-btn @click="createDialog=false">Cancel</v-btn>
<v-spacer></v-spacer>
<v-btn @click="saveRoom">Create</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-btn v-if="canCreate" @click="createDialog=true">Create Room</v-btn>
<v-row>
<v-col v-for="room in rooms" :key="room.id" cols="12">
<v-btn @click="joinRoom(room.ridn)" text>{{ room.room_name }}</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
name: "Room",
data: () => ({
rooms: [],
canCreate: false,
createDialog: false,
vcodecs: ['VP8','VP9','h264'],
acodecs: ['OPUS'],
roomCreate: {
video_codec: 'VP9',
audio_codec: 'OPUS',
publisher_count: 16,
room_name: ''
}
}),
mounted () {
this.getRooms()
},
methods: {
saveRoom () {
this.$axios.post('create/room',this.roomCreate).then(response => {
this.roomCreate ={
video_codec: 'VP9',
audio_codec: 'OPUS',
publisher_count: 16,
room_name: ''
}
this.getRooms()
this.createDialog = false
console.log(response)
})
},
joinRoom (id) {
this.$router.push('/room/' + id)
},
getRooms() {
this.$axios.get('rooms').then(response => {
console.log(response)
this.rooms = response.data.rooms
this.canCreate = response.data.can_create
}).catch(() => {
this.$router.push('/')
})
}
}
}
</script>
<style scoped>
</style>

@ -1,59 +0,0 @@
<template>
<div fill-height class="fill-height">
<v-dialog
v-model="dialog"
max-width="290"
>
<v-card>
<v-card-title class="headline">
What's your name ?
</v-card-title>
<v-card-text>
<v-text-field label="Name" v-model="name"></v-text-field>
</v-card-text>
<v-card-actions>
<v-btn @click="dialog=false" text>Cancel</v-btn>
<v-spacer></v-spacer>
<v-btn @click="getRoom" color="primary" text>Enter Room</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<VueJanus @kick="kick" v-if="rid" :creator="creator" :room="rid" server="wss://vid.w3ic.org/ws/janus/" :username="name"></VueJanus>
</div>
</template>
<script>
import VueJanus from "@/lib/VueJanus";
export default {
name: "RoomView",
components: {VueJanus},
data: () => ({
rid:'',
name:'',
dialog:false,
creator:false
}),
mounted () {
if (!name) this.dialog = true
},
methods: {
kick (user) {
this.$axios.get(`kick/${this.$route.params.id}/${user}`).then(response => {
console.log(response)
})
},
getRoom () {
this.dialog = false
this.$axios.get(`room/${this.$route.params.id}`).then(response => {
this.rid = response.data.rid
this.creator = response.data.can_modify
})
}
}
}
</script>
<style scoped>
</style>

@ -1,51 +0,0 @@
<template>
<v-container>
<v-row>
<v-col cols="12" md="12" sm="12" v-if="error">
<v-alert type="error">{{error}}</v-alert>
</v-col>
<v-col cols="12" md="6" sm="12">
<v-text-field placeholder="Name/Nickname" v-model="name"></v-text-field>
</v-col>
<v-col cols="12" md="6" sm="12">
<v-text-field placeholder="Code" v-model="code"></v-text-field>
</v-col>
<v-col cols="12" md="12" sm="12">
<v-text-field v-if="passwd" v-model="password" placeholder="Password" type="password"></v-text-field>
</v-col>
<v-col cols="12" md="6" sm="12"><v-btn @click="passwd=!passwd" text>Password Login</v-btn></v-col>
<v-col cols="12" md="6" sm="12">
<v-btn @click="login">Login</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
name: 'Home',
data:() => ({
passwd: false,
name:'',
code:'',
error:'',
password:''
}),
methods: {
login () {
this.$axios.post('login', {
username: this.code,
password: this.password
}).then(response => {
this.$store.state.token = response.data.access_token
this.$axios.defaults.headers.common['Authorization'] = "Bearer " + response.data.access_token
this.$store.state.name = this.name
this.$router.push('/rooms')
}).catch((resp) => {
this.error = resp.response.data.msg
})
}
}
}
</script>
Loading…
Cancel
Save