Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <body>
- <div id="remotes"></div>
- <div id="remotesVideos"></div>
- <video height="300" id="localVideo"></video>
- <script src="simplewebrtc ON YOUR SERVER LOCATION(install with npm)"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
- <script>
- var webrtc = new SimpleWebRTC({
- remoteVideosEl: 'remotesVideos',
- localVideoEl: 'localVideo',
- autoRequestMedia: true,
- detectSpeakingEvents: true,
- autoAdjustMic: false,
- url: 'https://website.com/',
- media: {
- video: false,
- audio: true
- },
- debug: false
- });
- webrtc.on('readyToCall', function () {
- webrtc.joinRoom('testing123');
- });
- SimpleWebRTC.sendDirectlyToAll('meta','info',{"foo": "bar"});
- SimpleWebRTC.on('channelMessage', function (Peer, Label, Data) {
- if ('hark' === Label) {
- return true;
- }
- if ('meta' === Label) {
- if ('info' === Data.type)
- {
- console.log(Data.payload.foo);
- }
- }
- }
- </script>
- </head>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment