1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import {SrsRTC } from './SrsRTC.js';
- import { Connection } from './connection.js';
- const sdk = new SrsRTC();
- const testConfig ={
- userId: '11111',
- roomId: '111',
- }
- const connection =new Connection(testConfig);
- console.log('sdk',sdk)
- console.log('sdk',connection)
- connection.socket.emit('pushVideo',{
- videoList:['0-1-0'],
- videoId: 'mini'
- })
- connection.socket.on('getVideo',(videoId)=>{
- console.log('getVideo',videoId)
- if(videoId){
- const steamUrl ='webrtc://demo-kms.4dage.com/live/' + videoId
- getVideo(steamUrl)
- }
- })
- const getVideo =(videoUrl)=>{
- $('#testVideoFeed').prop('srcObject', sdk.stream);
- sdk.getVideo(videoUrl).then(function(session){
- console.log('session',session.sessionid)
-
- }).catch(function (reason) {
- console.error(reason);
- })
- }
- // sdk.pc.ondatachannel = function(ev) {
- // console.log('Data channel is created!');
- // ev.channel.onopen = function() {
- // console.log('Data channel is open and ready to be used.');
- // };
- // };
|