some changes

backend-api
Mustafa Yontar 5 years ago
parent 71e39389b8
commit 4bff32dabb
  1. 3
      src/App.vue
  2. 4
      src/lib/RemoteFeed.vue
  3. 3
      src/lib/VueJanus.vue
  4. 9
      src/router/index.js
  5. 3
      src/store/index.js
  6. 8
      src/views/Home.vue
  7. 74
      src/views/Room.vue
  8. 28
      src/views/RoomView.vue

@ -1,6 +1,7 @@
<template> <template>
<v-app>
<v-content> <v-content>
<router-view></router-view> <router-view></router-view>
</v-content> </v-content></v-app>
</template> </template>

@ -87,6 +87,7 @@
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)
} }
@ -96,6 +97,7 @@
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})
}, },
@ -108,7 +110,6 @@
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"];
@ -117,7 +118,6 @@
} 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"]

@ -348,7 +348,6 @@
this.$janus.listDevices(this.initDevices); this.$janus.listDevices(this.initDevices);
}, },
initDevices (devices) { initDevices (devices) {
console.log(devices) console.log(devices)
@ -370,8 +369,8 @@
}, },
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) {

@ -7,12 +7,17 @@ Vue.use(VueRouter)
{ {
path: '/', path: '/',
name: 'Home', name: 'Home',
component: () => import(/* webpackChunkName: "about" */ '../views/Home.vue') component: () => import(/* webpackChunkName: "Home" */ '../views/Home.vue')
}, },
{ {
path: '/rooms', path: '/rooms',
name: 'Room', name: 'Room',
component: () => import(/* webpackChunkName: "about" */ '../views/Room.vue') component: () => import(/* webpackChunkName: "Room" */ '../views/Room.vue')
},
{
path: '/room/:id',
name: 'RoomView',
component: () => import(/* webpackChunkName: "RoomView" */ '../views/RoomView.vue')
} }
] ]

@ -5,7 +5,8 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
token: null token: null,
name: 'None'
}, },
mutations: { mutations: {
}, },

@ -1,6 +1,9 @@
<template> <template>
<v-container> <v-container>
<v-row> <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-col cols="12" md="6" sm="12">
<v-text-field placeholder="Name/Nickname" v-model="name"></v-text-field> <v-text-field placeholder="Name/Nickname" v-model="name"></v-text-field>
</v-col> </v-col>
@ -26,6 +29,7 @@ export default {
passwd: false, passwd: false,
name:'', name:'',
code:'', code:'',
error:'',
password:'' password:''
}), }),
methods: { methods: {
@ -35,7 +39,11 @@ export default {
password: this.password password: this.password
}).then(response => { }).then(response => {
this.$store.state.token = response.data.access_token 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') this.$router.push('/rooms')
}).catch((resp) => {
this.error = resp.response.data.msg
}) })
} }
} }

@ -1,10 +1,80 @@
<template> <template>
<div>room</div> <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> </template>
<script> <script>
export default { export default {
name: "Room" 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> </script>

@ -0,0 +1,28 @@
<template>
<VueJanus v-if="rid" :room="rid" server="https://vid.w3ic.org/janus" :username="$store.state.name"></VueJanus>
</template>
<script>
import VueJanus from "@/lib/VueJanus";
export default {
name: "RoomView",
components: {VueJanus},
data: () => ({
rid:''
}),
mounted () {
this.getRoom()
},
methods: {
getRoom () {
this.$axios.get(`room/${this.$route.params.id}`).then(response => {
this.rid = response.data.rid
})
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save