平安校园
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

55 rindas
1.7 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <script src="https://unpkg.com/aliyun-rts-sdk@1.2.1/dist/aliyun-rts-sdk.js"></script>
  7. </head>
  8. <body>
  9. <video id="video" controls muted="false"></video>
  10. </body>
  11. </html>
  12. <script>
  13. // // var socket = io.connect('http://localhost:3000');
  14. // var socket = io.connect('http://47.98.202.174');
  15. // socket.emit('commit', { message: 'hello world' });
  16. // socket.on('message', function (data) {
  17. // console.log('client message', data);
  18. // });
  19. var aliRts = new AliRTS()
  20. // aliRts.isSupport(supportInfo).then(re=> {
  21. // // 可用
  22. // }).catch(err=> {
  23. // // 不可用
  24. // console.log(`not support errorCode: ${err.errorCode}`);
  25. // console.log(`not support message: ${err.message}`);
  26. // });
  27. const pullStreamUrl = 'artc://rts-pull-live.deepeleph.com/quanjiang_DEMO00001/SXT003-0?auth_key=1720586611-0-0-d42e030b8f76246f7aacfbdba6620160&aliyun_uuid=dda449e6fecd461e8a445b992fa56b86';
  28. const mediaEle = document.querySelector('video');
  29. aliRts.on("onError", (err) => {
  30. console.log(`errorCode: ${err.errorCode}`);
  31. console.log(`message: ${err.message}`);
  32. })
  33. const PLAY_EVENT = {
  34. CANPLAY: "canplay",
  35. WAITING: "waiting",
  36. PLAYING: "playing"
  37. }
  38. aliRts.on('onPlayEvent', (play) => {
  39. console.log(">>play.event:" + play.event);
  40. if (play.event === PLAY_EVENT.CANPLAY) {
  41. // 拉流可以播放
  42. } else if (play.event === PLAY_EVENT.WAITING) {
  43. // 拉流卡顿等待缓冲中 (仅Chrome)
  44. } else if (play.event === PLAY_EVENT.PLAYING) {
  45. // 拉流卡顿结束恢复播放 (仅Chrome)
  46. }
  47. });
  48. aliRts.startLiveStream(pullStreamUrl, mediaEle);
  49. </script>