sp.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <script type="text/javascript" src="ezuikit.js"></script>
  2. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  3. <title></title>
  4. <body>
  5. <div id="myPlayer" style="width:100%;height: 100%">
  6. </div>
  7. <script>
  8. var player=null;
  9. window.onload=()=>{
  10. let windowWidth=document.documentElement.clientWidth;
  11. //标题设置为空,如果不设置为空,会与uni-app自带标题冲突
  12. document.title='\u200E';
  13. // 截取url与accessToken
  14. // console.log('111111111111111111',window.location.href)
  15. let url=window.location.href.split('?')[1].split('&')[0].split('=')[1]//url
  16. let accessToken=window.location.href.split('?')[1].split('&')[1].split('=')[1]//token
  17. init(url,accessToken);
  18. function init(url,accessToken)
  19. {
  20. player = new EZUIKit.EZUIKitPlayer({
  21. id: 'myPlayer',
  22. url: url,
  23. template: 'simple',
  24. accessToken: accessToken,
  25. autoplay: true,
  26. width: windowWidth,
  27. height: windowWidth * 2 / 3,
  28. });
  29. }
  30. }
  31. // window.pagehide=function(e){
  32. // console.log('111111111111111111',e)
  33. //   var e = window.event||e;
  34. //   e.returnValue=("确定离开当前页面吗?");
  35. // }
  36. window.addEventListener('pageshow', function (e) {
  37. console.log('111111111111111111',e)
  38. if (e.persisted) {
  39. window.location.reload()
  40. }
  41. })
  42. </script>
  43. </body>