index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // setTimeout(() => {
  2. // console.log('-----unity实例', unityExamples);
  3. // }, 2000);
  4. const videoBox = document.querySelector('.videoBox')
  5. const videoDom = document.querySelector('.videoBox video')
  6. const videoBtnDom = document.querySelector('.skipTxt')
  7. // 自动播放视频
  8. videoDom.play()
  9. // 点击按钮,或者视频播放完毕的回调
  10. const videoPalyEnd = () => {
  11. console.log('-------视频播放完毕,或者点击跳过--------');
  12. document.querySelector('body').removeChild(videoBox)
  13. }
  14. videoDom.addEventListener('ended', function () {
  15. videoPalyEnd()
  16. }, false)
  17. videoBtnDom.onclick = () => {
  18. videoPalyEnd()
  19. }
  20. // 分享页面
  21. const shareDom = document.querySelector('.shareBox')
  22. window.onClickShare = () => {
  23. // console.log(123456);
  24. shareDom.style.opacity = '1'
  25. shareDom.style.pointerEvents = 'auto'
  26. // var a = document.createElement('a')
  27. // a.download = 'image'
  28. // a.href = '../StreamingAssets/share.png'
  29. // a.click()
  30. }
  31. document.querySelector('.shareBtn').onclick = () => {
  32. shareDom.style.opacity = '0'
  33. shareDom.style.pointerEvents = 'none'
  34. }