BLUSHIF

Untitled

Jul 30th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <body>
  5. <div id="remotes"></div>
  6. <div id="remotesVideos"></div>
  7. <video height="300" id="localVideo"></video>
  8. <script src="simplewebrtc ON YOUR SERVER LOCATION(install with npm)"></script>
  9. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  10. <script>
  11. var webrtc = new SimpleWebRTC({
  12. remoteVideosEl: 'remotesVideos',
  13. localVideoEl: 'localVideo',
  14. autoRequestMedia: true,
  15. detectSpeakingEvents: true,
  16. autoAdjustMic: false,
  17. url: 'https://website.com/',
  18. media: {
  19. video: false,
  20. audio: true
  21. },
  22. debug: false
  23. });
  24. webrtc.on('readyToCall', function () {
  25. webrtc.joinRoom('testing123');
  26. });
  27. SimpleWebRTC.sendDirectlyToAll('meta','info',{"foo": "bar"});
  28. SimpleWebRTC.on('channelMessage', function (Peer, Label, Data) {
  29. if ('hark' === Label) {
  30. return true;
  31. }
  32. if ('meta' === Label) {
  33.  
  34. if ('info' === Data.type)
  35. {
  36. console.log(Data.payload.foo);
  37. }
  38. }
  39. }
  40. </script>
  41. </head>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment