平安校园
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

artcvideo.html 1.8 KiB

2 ay önce
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. <style>
  8. #video {
  9. width: 100%;
  10. height: 100%;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <video id="video" controls muted="false"></video>
  16. </body>
  17. </html>
  18. <script>
  19. // // var socket = io.connect('http://localhost:3000');
  20. // var socket = io.connect('http://47.98.202.174');
  21. // socket.emit('commit', { message: 'hello world' });
  22. // socket.on('message', function (data) {
  23. // console.log('client message', data);
  24. // });
  25. var aliRts = new AliRTS()
  26. // aliRts.isSupport(supportInfo).then(re=> {
  27. // // 可用
  28. // }).catch(err=> {
  29. // // 不可用
  30. // console.log(`not support errorCode: ${err.errorCode}`);
  31. // console.log(`not support message: ${err.message}`);
  32. // });
  33. const pullStreamUrl = 'artc://rts-pull-live.deepeleph.com/quanjiang_DEMO00001/SXT003-0?auth_key=1724921782-0-0-d7ac627dd65378c195ced9de16c63bc4&aliyun_uuid=edbaf313fe5a4102bfcf4951f38ebbf8';
  34. const mediaEle = document.querySelector('video');
  35. aliRts.on("onError", (err) => {
  36. console.log(`errorCode: ${err.errorCode}`);
  37. console.log(`message: ${err.message}`);
  38. })
  39. const PLAY_EVENT = {
  40. CANPLAY: "canplay",
  41. WAITING: "waiting",
  42. PLAYING: "playing"
  43. }
  44. aliRts.on('onPlayEvent', (play) => {
  45. console.log(">>play.event:" + play.event);
  46. if (play.event === PLAY_EVENT.CANPLAY) {
  47. // 拉流可以播放
  48. } else if (play.event === PLAY_EVENT.WAITING) {
  49. // 拉流卡顿等待缓冲中 (仅Chrome)
  50. } else if (play.event === PLAY_EVENT.PLAYING) {
  51. // 拉流卡顿结束恢复播放 (仅Chrome)
  52. }
  53. });
  54. aliRts.startLiveStream(pullStreamUrl, mediaEle);
  55. </script>