|
@@ -160,7 +160,7 @@
|
|
<script>
|
|
<script>
|
|
/** 广播设置 */
|
|
/** 广播设置 */
|
|
import { AG_GRID_LOCALE_CN } from '@/utils/AgGridVueLocaleCn'
|
|
import { AG_GRID_LOCALE_CN } from '@/utils/AgGridVueLocaleCn'
|
|
-import ButtonCellRender from '../../components/AgGridCellRender/ButtonCellRender'
|
|
|
|
|
|
+import ButtonCellRenderList from '@/components/AgGridCellRender/ButtonCellRenderList'
|
|
import * as API_Broadcast from '@/api/calling-broadcast'
|
|
import * as API_Broadcast from '@/api/calling-broadcast'
|
|
import { unix2Date } from '@/utils/Foundation'
|
|
import { unix2Date } from '@/utils/Foundation'
|
|
import * as API_FrameGroup from '@/api/ncs_frameGroup'
|
|
import * as API_FrameGroup from '@/api/ncs_frameGroup'
|
|
@@ -170,9 +170,17 @@ import * as API_BroadcastFiles from '@/api/calling-broadcastFiles'
|
|
// import { serverUrl, DeviceUrl } from '@/utils/domain'
|
|
// import { serverUrl, DeviceUrl } from '@/utils/domain'
|
|
const serverUrl = domain.serverUrl
|
|
const serverUrl = domain.serverUrl
|
|
const DeviceUrl = domain.DeviceUrl
|
|
const DeviceUrl = domain.DeviceUrl
|
|
|
|
+
|
|
|
|
+const server = "ws://192.168.1.55:8188/janus";
|
|
|
|
+let janus = null;
|
|
|
|
+let streaming = null;
|
|
|
|
+let opaqueId = "streamingtest-"+Janus.randomString(12);
|
|
|
|
+let bitrateTimer = null;
|
|
|
|
+let spinner = null;
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
name: 'Index',
|
|
name: 'Index',
|
|
- components: { ButtonCellRender, ListFilter, RadioFilter },
|
|
|
|
|
|
+ components: { ButtonCellRenderList, ListFilter, RadioFilter },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
tableData: [],
|
|
tableData: [],
|
|
@@ -317,55 +325,36 @@ export default {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
headerName: this.$t('action.edit'), field: 'shop_id',
|
|
headerName: this.$t('action.edit'), field: 'shop_id',
|
|
- cellRendererFramework: 'ButtonCellRender',
|
|
|
|
- cellRendererParams: {
|
|
|
|
- onClick: this.handEdit,
|
|
|
|
- label: this.$t('action.edit'),
|
|
|
|
- buttonType: 'primary',
|
|
|
|
- buttonSize: 'mini'
|
|
|
|
- },
|
|
|
|
- filter: false,
|
|
|
|
- pinned: 'right',
|
|
|
|
- lockPinned: true,
|
|
|
|
- width: 100,
|
|
|
|
- resizable: false,
|
|
|
|
- sortable: false
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- headerName: this.$t('action.delete'), field: 'shop_id',
|
|
|
|
- cellRendererFramework: 'ButtonCellRender',
|
|
|
|
|
|
+ cellRendererFramework: 'ButtonCellRenderList',
|
|
cellRendererParams: param => {
|
|
cellRendererParams: param => {
|
|
return {
|
|
return {
|
|
- onClick: this.deleteSingle,
|
|
|
|
- label: this.$t('action.delete'),
|
|
|
|
- buttonType: 'danger',
|
|
|
|
- buttonSize: 'mini'
|
|
|
|
- }
|
|
|
|
|
|
+ list: [
|
|
|
|
+ {
|
|
|
|
+ onClick: this.handEdit,
|
|
|
|
+ label: this.$t('action.edit'),
|
|
|
|
+ buttonType: 'primary',
|
|
|
|
+ buttonSize: 'mini'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ onClick: this.deleteSingle,
|
|
|
|
+ label: this.$t('action.delete'),
|
|
|
|
+ buttonType: 'danger',
|
|
|
|
+ buttonSize: 'mini'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ onClick: () => { param.data.playing ? this.stopBroadcast(param.data) : this.playBroadcast(param.data) },
|
|
|
|
+ label: param.data.playing ? this.$t('broadcast.stop') : this.$t('broadcast.play'),
|
|
|
|
+ buttonType: param.data.playing ? 'danger' : 'primary',
|
|
|
|
+ buttonSize: 'mini',
|
|
|
|
+ disabled: param.data.broadcast_mode !== 1 || !param.data.status
|
|
|
|
+ }
|
|
|
|
+ ]}
|
|
},
|
|
},
|
|
- pinned: 'right',
|
|
|
|
- lockPinned: true,
|
|
|
|
- width: 100,
|
|
|
|
- resizable: false,
|
|
|
|
filter: false,
|
|
filter: false,
|
|
- sortable: false
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- headerName: this.$t('broadcast.play'), field: 'id',
|
|
|
|
- cellRendererFramework: 'ButtonCellRender',
|
|
|
|
- cellRendererParams: param => {
|
|
|
|
- return {
|
|
|
|
- onClick: () => { param.data.playing ? this.stopBroadcast(param.data) : this.playBroadcast(param.data) },
|
|
|
|
- label: param.data.playing ? this.$t('broadcast.stop') : this.$t('broadcast.play'),
|
|
|
|
- buttonType: param.data.playing ? 'danger' : 'primary',
|
|
|
|
- buttonSize: 'mini',
|
|
|
|
- disabled: param.data.broadcast_mode !== 1 || !param.data.status
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
pinned: 'right',
|
|
pinned: 'right',
|
|
lockPinned: true,
|
|
lockPinned: true,
|
|
- width: 100,
|
|
|
|
|
|
+ width: 220,
|
|
resizable: false,
|
|
resizable: false,
|
|
- filter: false,
|
|
|
|
sortable: false
|
|
sortable: false
|
|
}
|
|
}
|
|
]
|
|
]
|
|
@@ -404,6 +393,7 @@ export default {
|
|
_this.initWebSocket()
|
|
_this.initWebSocket()
|
|
}
|
|
}
|
|
}, 60000)
|
|
}, 60000)
|
|
|
|
+ // this.initJanus()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
windowResize() {
|
|
windowResize() {
|
|
@@ -438,8 +428,20 @@ export default {
|
|
},
|
|
},
|
|
deleteSingle(row) {
|
|
deleteSingle(row) {
|
|
this.handlerDelete(row.id)
|
|
this.handlerDelete(row.id)
|
|
|
|
+ let body = {
|
|
|
|
+ request: "destroy",
|
|
|
|
+ id: row.id,
|
|
|
|
+ permanent: true
|
|
|
|
+ };
|
|
|
|
+ Janus.debug("Sending message:", body);
|
|
|
|
+ streaming.send({message:body, success: function(result){
|
|
|
|
+ if(!result) {
|
|
|
|
+ bootbox.alert("Got no response to our query");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Janus.debug("receiving message:", result);
|
|
|
|
+ }});
|
|
},
|
|
},
|
|
-
|
|
|
|
playBroadcast(row) {
|
|
playBroadcast(row) {
|
|
// API_BroadcastFiles.getAllFileByBroadcastId(row.id).then(res => {
|
|
// API_BroadcastFiles.getAllFileByBroadcastId(row.id).then(res => {
|
|
// if (Array.isArray(res)) {
|
|
// if (Array.isArray(res)) {
|
|
@@ -454,7 +456,6 @@ export default {
|
|
// this.gridApi.redrawRows()
|
|
// this.gridApi.redrawRows()
|
|
// })
|
|
// })
|
|
},
|
|
},
|
|
-
|
|
|
|
stopBroadcast(row) {
|
|
stopBroadcast(row) {
|
|
this.websock.send(JSON.stringify({ 'command': 'stop', 'broadcast_id': row.id }))
|
|
this.websock.send(JSON.stringify({ 'command': 'stop', 'broadcast_id': row.id }))
|
|
// API_Broadcast.stopBroadcast(row.id).then(() => {
|
|
// API_Broadcast.stopBroadcast(row.id).then(() => {
|
|
@@ -462,7 +463,6 @@ export default {
|
|
// this.gridApi.redrawRows()
|
|
// this.gridApi.redrawRows()
|
|
// })
|
|
// })
|
|
},
|
|
},
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 创建广播
|
|
* 创建广播
|
|
*/
|
|
*/
|
|
@@ -481,7 +481,6 @@ export default {
|
|
this.params.page_size = size
|
|
this.params.page_size = size
|
|
this.getList()
|
|
this.getList()
|
|
},
|
|
},
|
|
-
|
|
|
|
/** 分页页数发生改变 */
|
|
/** 分页页数发生改变 */
|
|
handlePageCurrentChange(page) {
|
|
handlePageCurrentChange(page) {
|
|
this.params.page_no = page
|
|
this.params.page_no = page
|
|
@@ -535,7 +534,6 @@ export default {
|
|
if (!param.value) return ''
|
|
if (!param.value) return ''
|
|
return unix2Date(param.value * 1000)
|
|
return unix2Date(param.value * 1000)
|
|
},
|
|
},
|
|
-
|
|
|
|
radioFilterFormatter(params, array) {
|
|
radioFilterFormatter(params, array) {
|
|
const item = array.filter(p => p.value === params.value)[0]
|
|
const item = array.filter(p => p.value === params.value)[0]
|
|
if (item) {
|
|
if (item) {
|
|
@@ -548,7 +546,6 @@ export default {
|
|
return ''
|
|
return ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
statusFormatter(params) {
|
|
statusFormatter(params) {
|
|
console.log('para', params)
|
|
console.log('para', params)
|
|
const item = this.broadcastStatus.filter(p => (p.value === (!params.value ? false : params.value)))[0] // params.value === null 时,要返回false的记录
|
|
const item = this.broadcastStatus.filter(p => (p.value === (!params.value ? false : params.value)))[0] // params.value === null 时,要返回false的记录
|
|
@@ -616,25 +613,61 @@ export default {
|
|
* @param formname
|
|
* @param formname
|
|
*/
|
|
*/
|
|
handlerFormSubmit(formName) {
|
|
handlerFormSubmit(formName) {
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- /** 新增 */
|
|
|
|
- delete this.formmodel.id
|
|
|
|
- this.formmodel.part_id = this.$store.getters.partId
|
|
|
|
- // const starttime = new Date(this.timeRange[0]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
- // const endtime = new Date(this.timeRange[1]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
- // this.formmodel.play_start = starttime
|
|
|
|
- // this.formmodel.play_end = endtime
|
|
|
|
|
|
+ let body = {
|
|
|
|
+ request: "create",
|
|
|
|
+ type: "rtp",
|
|
|
|
+ id: 142,
|
|
|
|
+ description: this.formmodel.title,
|
|
|
|
+ metadata: "okokok",
|
|
|
|
+ permanent: true,
|
|
|
|
+ audio: true,
|
|
|
|
+ video: false,
|
|
|
|
+ audioport : 5001,
|
|
|
|
+ audiopt : 111,
|
|
|
|
+ audiortpmap : "opus/48000/2"
|
|
|
|
+ };
|
|
|
|
+ Janus.debug("Sending message:", body);
|
|
|
|
+ streaming.send({message:body, success: function(result){
|
|
|
|
+// error: "Error creating 'rtp' stream"
|
|
|
|
+// error_code: 456
|
|
|
|
+// streaming: "event"
|
|
|
|
|
|
- API_Broadcast.add(this.formmodel).then(() => {
|
|
|
|
- this.formshow = false
|
|
|
|
- this.$message.success(this.$t('action.saveSuccess'))
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- this.$message.error(this.$t('action.fromError'))
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+// created: "mp-308"
|
|
|
|
+// permanent: true
|
|
|
|
+// stream:
|
|
|
|
+// audio_port: 50023
|
|
|
|
+// description: "abcdefg"
|
|
|
|
+// id: 308
|
|
|
|
+// is_private: false
|
|
|
|
+// type: "live"
|
|
|
|
+// [[Prototype]]: Object
|
|
|
|
+// streaming: "created"
|
|
|
|
+ console.log('result===', result)
|
|
|
|
+ if(!result) {
|
|
|
|
+ bootbox.alert("Got no response to our query");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Janus.debug("receiving message:", result);
|
|
|
|
+ }});
|
|
|
|
+ // this.$refs[formName].validate((valid) => {
|
|
|
|
+ // if (valid) {
|
|
|
|
+ // /** 新增 */
|
|
|
|
+ // delete this.formmodel.id
|
|
|
|
+ // this.formmodel.part_id = this.$store.getters.partId
|
|
|
|
+ // // const starttime = new Date(this.timeRange[0]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
+ // // const endtime = new Date(this.timeRange[1]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
+ // // this.formmodel.play_start = starttime
|
|
|
|
+ // // this.formmodel.play_end = endtime
|
|
|
|
+ //
|
|
|
|
+ // API_Broadcast.add(this.formmodel).then(() => {
|
|
|
|
+ // this.formshow = false
|
|
|
|
+ // this.$message.success(this.$t('action.saveSuccess'))
|
|
|
|
+ // this.getList()
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$message.error(this.$t('action.fromError'))
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
},
|
|
},
|
|
broadcastModeChanage(val) { // 变换广播模式,手动模式可以不选择播放模式,自动模式需要选择播放模式,定时播放或者定次播放
|
|
broadcastModeChanage(val) { // 变换广播模式,手动模式可以不选择播放模式,自动模式需要选择播放模式,定时播放或者定次播放
|
|
if (val === 1) { // 手动模式
|
|
if (val === 1) { // 手动模式
|
|
@@ -683,7 +716,6 @@ export default {
|
|
console.log('groups', this.frameGroups)
|
|
console.log('groups', this.frameGroups)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
-
|
|
|
|
initWebSocket: function() {
|
|
initWebSocket: function() {
|
|
const stockbase = DeviceUrl.replace('http', 'ws')
|
|
const stockbase = DeviceUrl.replace('http', 'ws')
|
|
this.websock = new WebSocket(stockbase + '/broadcast/status/' + this.$store.getters.uuid)
|
|
this.websock = new WebSocket(stockbase + '/broadcast/status/' + this.$store.getters.uuid)
|
|
@@ -702,11 +734,9 @@ export default {
|
|
this.scheduledIds = JSON.parse(e.data)
|
|
this.scheduledIds = JSON.parse(e.data)
|
|
this.refreshPlayStatus()
|
|
this.refreshPlayStatus()
|
|
},
|
|
},
|
|
-
|
|
|
|
websocketclose: function(e) {
|
|
websocketclose: function(e) {
|
|
console.log('connection closed (' + e.code + ')')
|
|
console.log('connection closed (' + e.code + ')')
|
|
},
|
|
},
|
|
-
|
|
|
|
refreshPlayStatus() {
|
|
refreshPlayStatus() {
|
|
if (this.rowData !== null) {
|
|
if (this.rowData !== null) {
|
|
this.rowData.forEach(item => {
|
|
this.rowData.forEach(item => {
|
|
@@ -719,6 +749,72 @@ export default {
|
|
})
|
|
})
|
|
this.gridApi.redrawRows()
|
|
this.gridApi.redrawRows()
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ initJanus() {
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.$(document).ready(function() {
|
|
|
|
+ // Initialize the library (all console debuggers enabled)
|
|
|
|
+ Janus.init({debug: "all", callback: function() {
|
|
|
|
+ // Use a button to start the demo
|
|
|
|
+ _this.$(this).attr('disabled', true).unbind('click');
|
|
|
|
+ // Make sure the browser supports WebRTC
|
|
|
|
+ if(!Janus.isWebrtcSupported()) {
|
|
|
|
+ bootbox.alert("No WebRTC support... ");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Create session
|
|
|
|
+ janus = new Janus(
|
|
|
|
+ {
|
|
|
|
+ server: server,
|
|
|
|
+ success: function() {
|
|
|
|
+ // Attach to Streaming plugin
|
|
|
|
+ janus.attach(
|
|
|
|
+ {
|
|
|
|
+ plugin: "janus.plugin.streaming",
|
|
|
|
+ opaqueId: opaqueId,
|
|
|
|
+ success: function(pluginHandle) {
|
|
|
|
+ _this.$('#details').remove();
|
|
|
|
+ streaming = pluginHandle;
|
|
|
|
+ Janus.log("Plugin attached! (" + streaming.getPlugin() + ", id=" + streaming.getId() + ")");
|
|
|
|
+ },
|
|
|
|
+ error: function(error) {
|
|
|
|
+ Janus.error(" -- Error attaching plugin... ", error);
|
|
|
|
+ bootbox.alert("Error attaching plugin... " + error);
|
|
|
|
+ },
|
|
|
|
+ iceState: function(state) {
|
|
|
|
+ Janus.log("ICE state changed to " + state);
|
|
|
|
+ },
|
|
|
|
+ webrtcState: function(on) {
|
|
|
|
+ Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now");
|
|
|
|
+ },
|
|
|
|
+ onmessage: function(msg, jsep) {
|
|
|
|
+ Janus.debug(" ::: Got a message :::", msg);
|
|
|
|
+ },
|
|
|
|
+ onremotestream: function(stream) {
|
|
|
|
+ Janus.debug(" ::: Got a remote stream :::", stream);
|
|
|
|
+ },
|
|
|
|
+ ondataopen: function(data) {
|
|
|
|
+ },
|
|
|
|
+ ondata: function(data) {
|
|
|
|
+ Janus.debug("We got data from the DataChannel!", data);
|
|
|
|
+ },
|
|
|
|
+ oncleanup: function() {
|
|
|
|
+ Janus.log(" ::: Got a cleanup notification :::");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ error: function(error) {
|
|
|
|
+ Janus.error(error);
|
|
|
|
+ bootbox.alert(error, function() {
|
|
|
|
+ window.location.reload();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ destroyed: function() {
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }});
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|