kankan.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. html,
  9. body {
  10. width: 100%;
  11. height: 100%;
  12. margin: 0;
  13. overflow: hidden;
  14. }
  15. .scene {
  16. width: 100%;
  17. height: 100%;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div id="scene" class="scene"></div>
  23. <div class="map"></div>
  24. <script>
  25. const params = new URLSearchParams(location.search)
  26. const env = params.get('env')
  27. let host = 'http://192.168.0.25'
  28. if (env === 'prod') {
  29. host = ''
  30. }
  31. const $script1 = document.createElement('script')
  32. $script1.src = `${host}/sdk/kankan-sdk-deps.js`
  33. document.documentElement.appendChild($script1)
  34. const $script2 = document.createElement('script')
  35. $script2.src = `${host}/sdk/kankan-sdk.js`
  36. document.documentElement.appendChild($script2)
  37. let loadPackCount = 0
  38. $script1.onload = () => {
  39. ++loadPackCount
  40. init()
  41. }
  42. $script2.onload = () => {
  43. ++loadPackCount
  44. init()
  45. }
  46. const init = async () => {
  47. if (loadPackCount < 2) return;
  48. await setTimeout(() => {}, 1000)
  49. var kankan = new KanKan({
  50. dom: '#scene',
  51. num: params.get('m'),
  52. server: host,
  53. resource: host + '/oss/'
  54. })
  55. // kankan.Scene.on('loaded', () => {
  56. // const player = kankan.core.get('Player')
  57. // player.viewLinkManager.addEventListener('loaded', () => {
  58. // player.viewLinkManager.hideAllViews()
  59. // })
  60. // })
  61. kankan.render()
  62. }
  63. </script>
  64. <script>
  65. </script>
  66. </body>
  67. </html>