main.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import '../style/style';
  2. import '../style/index';
  3. import $ from 'jquery';
  4. import { setTimeout } from 'timers';
  5. $(document).ready(function() {
  6. const dataList = window.sessionStorage.getItem('dataList');
  7. if(!dataList) {
  8. window.location.href="./login.html";
  9. return false;
  10. }
  11. const boardUrl = JSON.parse(dataList).shareTask.boardUrl;
  12. const desktopUrl = JSON.parse(dataList).shareTask.desktopUrl;
  13. const title = JSON.parse(dataList).shareTask.title;
  14. const shareJoinUserId = JSON.parse(dataList).shareJoinUser.id;
  15. $('.title p').html('主会场:' + title)
  16. console.log(boardUrl)
  17. console.log(desktopUrl)
  18. let bigVideo = new FlvJsPlayer({
  19. "id": "bigVideo",
  20. "url": boardUrl,
  21. "playsinline": false,
  22. "volume": 1,
  23. "autoplay": true,
  24. "width": "100%",
  25. "height": "714",
  26. "ignores": ['definition', 'i18n', 'play', 'replay', 'progress', 'start', 'time'],
  27. "closeVideoClick": true,
  28. "closeVideoTouch": true,
  29. "keyShortcut": "off",
  30. "cssFullscreen": true
  31. });
  32. let smallVideo = new FlvJsPlayer({
  33. "id": "smallVideo",
  34. "url": desktopUrl,
  35. "playsinline": false,
  36. "volume": 0,
  37. "autoplay": true,
  38. "width": "100%",
  39. "height": "714",
  40. "ignores": ['definition', 'i18n', 'play', 'replay', 'progress', 'start', 'time'],
  41. "closeVideoClick": true,
  42. "closeVideoTouch": true,
  43. "keyShortcut": "off",
  44. "cssFullscreen": true
  45. });
  46. bigVideo.on('requestFullscreen',function(){
  47. console.log('1全屏')
  48. bigVideo.volume = 1;
  49. smallVideo.volume = 0;
  50. console.log(bigVideo.volume);
  51. })
  52. smallVideo.on('requestFullscreen',function(){
  53. console.log('2全屏')
  54. bigVideo.volume = 0;
  55. smallVideo.volume = 1;
  56. console.log(smallVideo.volume);
  57. })
  58. let time = null;
  59. // 判断用户是否存在回调
  60. time = setInterval(function () {
  61. $.get(`${process.env.BASE_API}sharedWhiteBoard/shareJoin/update`, {
  62. shareJoinUserId
  63. }, function (res) {
  64. if(res.code == 200) {
  65. if(res.data.status == 'DEL') {
  66. // alert('暂无观看权限');
  67. bigVideo.destroy();
  68. smallVideo.destroy();
  69. $('.title p').hide();
  70. $('.video').css('background', '#ccc');
  71. $('.err').show();
  72. clearTimeout(time);
  73. // window.location.href="./login.html";
  74. }
  75. }
  76. });
  77. },5000)
  78. })