leiting-bim 2.1.35 → 2.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/leiting-bim.es.js +2818 -2687
- package/leiting-bim.umd.js +9 -9
- package/leitingbim.css +1 -1
- package/package.json +1 -1
- package/plugins/.gitmodules +4 -0
- package/plugins/README.md +2 -0
- package/plugins/build.cjs +63 -0
- package/plugins/cesium-core/dist/cesium-core.mjs +6217 -0
- package/plugins/cesium-core/dist/cesium-core.umd.js +76 -0
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +73 -0
- package/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +152 -0
- package/plugins/cesium-core/dist/components/MarkerEvent.d.ts +38 -0
- package/plugins/cesium-core/dist/components/Material/MaterialManager.d.ts +49 -0
- package/plugins/cesium-core/dist/components/Material/help/PolylineFlowMaterialProperty.d.ts +10 -0
- package/plugins/cesium-core/dist/components/Material/help/dynamicImgMaterial.d.ts +16 -0
- package/plugins/cesium-core/dist/components/Material/index.d.ts +3 -0
- package/plugins/cesium-core/dist/components/TooltipManager.d.ts +11 -0
- package/plugins/cesium-core/dist/components/draw/DrawTool.d.ts +10 -0
- package/plugins/cesium-core/dist/components/draw/handlers/CircleDrawer.d.ts +16 -0
- package/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +14 -0
- package/plugins/cesium-core/dist/components/draw/handlers/PointDrawer.d.ts +12 -0
- package/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +14 -0
- package/plugins/cesium-core/dist/components/draw/handlers/RectangleDrawer.d.ts +13 -0
- package/plugins/cesium-core/dist/components/draw/types.d.ts +29 -0
- package/plugins/cesium-core/dist/components/entity/EntityLayer.d.ts +65 -0
- package/plugins/cesium-core/dist/components/gltf/GLTFManage.d.ts +141 -0
- package/plugins/cesium-core/dist/components/gltf/index.d.ts +1 -0
- package/plugins/cesium-core/dist/components/measurement/MeasurementTool.d.ts +34 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +28 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/CircleMeasure.d.ts +22 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/CoordinateMeasure.d.ts +16 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +27 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +25 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/RectangleMeasure.d.ts +30 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/RegularPolygonMeasure.d.ts +28 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/SpaceMeasure.d.ts +21 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/TerrainHeightMeasure.d.ts +18 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/TriangleMeasure.d.ts +30 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/VerticalMeasure.d.ts +23 -0
- package/plugins/cesium-core/dist/components/measurement/index.d.ts +13 -0
- package/plugins/cesium-core/dist/components/measurement/types.d.ts +42 -0
- package/plugins/cesium-core/dist/components/primitive/PrimitiveManager.d.ts +50 -0
- package/plugins/cesium-core/dist/components/roaming/CameraRoamTool.d.ts +27 -0
- package/plugins/cesium-core/dist/components/roaming/PathRoamTool.d.ts +23 -0
- package/plugins/cesium-core/dist/components/roaming/index.d.ts +3 -0
- package/plugins/cesium-core/dist/components/roaming/types.d.ts +66 -0
- package/plugins/cesium-core/dist/components/utils/convertGeoJsonToEntityData.d.ts +1 -0
- package/plugins/cesium-core/dist/components/utils/uuid.d.ts +1 -0
- package/plugins/cesium-core/dist/index.d.ts +12 -0
- package/plugins/cesium-core/package.json +27 -0
- package/plugins/cesium-core/pnpm-lock.yaml +872 -0
- package/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +546 -0
- package/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +489 -0
- package/plugins/cesium-core/src/components/MarkerEvent.ts +92 -0
- package/plugins/cesium-core/src/components/Material/MaterialManager.ts +129 -0
- package/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +116 -0
- package/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +236 -0
- package/plugins/cesium-core/src/components/Material/index.ts +3 -0
- package/plugins/cesium-core/src/components/TooltipManager.ts +52 -0
- package/plugins/cesium-core/src/components/draw/DrawTool.ts +55 -0
- package/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +159 -0
- package/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +113 -0
- package/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +70 -0
- package/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +112 -0
- package/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +115 -0
- package/plugins/cesium-core/src/components/draw/types.ts +28 -0
- package/plugins/cesium-core/src/components/entity/EntityLayer.ts +453 -0
- package/plugins/cesium-core/src/components/gltf/GLTFManage.ts +799 -0
- package/plugins/cesium-core/src/components/gltf/index.ts +1 -0
- package/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +416 -0
- package/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +552 -0
- package/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +289 -0
- package/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +139 -0
- package/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +427 -0
- package/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +356 -0
- package/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +516 -0
- package/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +472 -0
- package/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +250 -0
- package/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +185 -0
- package/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +561 -0
- package/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +361 -0
- package/plugins/cesium-core/src/components/measurement/index.ts +13 -0
- package/plugins/cesium-core/src/components/measurement/types.ts +57 -0
- package/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +556 -0
- package/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +286 -0
- package/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +174 -0
- package/plugins/cesium-core/src/components/roaming/index.ts +3 -0
- package/plugins/cesium-core/src/components/roaming/types.ts +71 -0
- package/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +98 -0
- package/plugins/cesium-core/src/components/utils/uuid.ts +7 -0
- package/plugins/cesium-core/src/index.ts +17 -0
- package/plugins/cesium-core/src/test/measurement/index.html +166 -0
- package/plugins/cesium-core/src/test/roaming/c.gltf +1 -0
- package/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/cesium-core/src/test/roaming/index.html +51 -0
- package/plugins/cesium-core/src/test/roaming/path.html +448 -0
- package/plugins/cesium-core/src/test/roaming/view.html +520 -0
- package/plugins/cesium-core/stats.html +4949 -0
- package/plugins/cesium-core/tsconfig.json +14 -0
- package/plugins/cesium-core/vite.config.ts +35 -0
- package/plugins/cesium-vue/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/plugins/cesium-vue/dist/components/basic-audio/index.d.ts +13 -0
- package/plugins/cesium-vue/dist/components/basic-audio.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/basic-audio.js +1295 -0
- package/plugins/cesium-vue/dist/components/basic-video/index.d.ts +98 -0
- package/plugins/cesium-vue/dist/components/basic-video.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/basic-video.js +67 -0
- package/plugins/cesium-vue/dist/components/card-carousel/index.d.ts +147 -0
- package/plugins/cesium-vue/dist/components/card-carousel.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-carousel.js +143 -0
- package/plugins/cesium-vue/dist/components/card-content/index.d.ts +16 -0
- package/plugins/cesium-vue/dist/components/card-content.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-content.js +74 -0
- package/plugins/cesium-vue/dist/components/card-page/index.d.ts +64 -0
- package/plugins/cesium-vue/dist/components/card-page.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-page.js +111 -0
- package/plugins/cesium-vue/dist/components/carousel-img/index.d.ts +34 -0
- package/plugins/cesium-vue/dist/components/carousel-img.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/carousel-img.js +72 -0
- package/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts +63 -0
- package/plugins/cesium-vue/dist/components/echarts-pro.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/echarts-pro.js +7 -0
- package/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/components/marker-bubble.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-bubble.js +123 -0
- package/plugins/cesium-vue/dist/components/marker-default/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/components/marker-default.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-default.js +39 -0
- package/plugins/cesium-vue/dist/components/marker-html/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/components/marker-html.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-html.js +40 -0
- package/plugins/cesium-vue/dist/components/marker-manage/index.d.ts +159 -0
- package/plugins/cesium-vue/dist/components/marker-manage.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-manage.js +896 -0
- package/plugins/cesium-vue/dist/components/marker-text/index.d.ts +25 -0
- package/plugins/cesium-vue/dist/components/marker-text.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-text.js +30 -0
- package/plugins/cesium-vue/dist/components/measurement/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/components/measurement.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/measurement.js +170 -0
- package/plugins/cesium-vue/dist/create-DynflqE1.js +31 -0
- package/plugins/cesium-vue/dist/index-B03tSn8_.js +45855 -0
- package/plugins/cesium-vue/dist/index-CUs_hd1V.js +403 -0
- package/plugins/cesium-vue/dist/index.d.ts +44 -0
- package/plugins/cesium-vue/dist/index.js +82 -0
- package/plugins/cesium-vue/package.json +106 -0
- package/plugins/cesium-vue/src/assets/icons/icon-001.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-002.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-003.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-004.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-005.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-006.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-007.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-008.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-009.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-010.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-011.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-012.png +0 -0
- package/plugins/cesium-vue/src/assets/img/Card3-BG.png +0 -0
- package/plugins/cesium-vue/src/assets/img/card_bg3.png +0 -0
- package/plugins/cesium-vue/src/components/basic-audio/index.ts +6 -0
- package/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +119 -0
- package/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +6 -0
- package/plugins/cesium-vue/src/components/basic-video/index.ts +7 -0
- package/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +58 -0
- package/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +14 -0
- package/plugins/cesium-vue/src/components/card-carousel/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +124 -0
- package/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +60 -0
- package/plugins/cesium-vue/src/components/card-content/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +41 -0
- package/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +22 -0
- package/plugins/cesium-vue/src/components/card-page/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +102 -0
- package/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +37 -0
- package/plugins/cesium-vue/src/components/carousel-img/index.ts +7 -0
- package/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +84 -0
- package/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +8 -0
- package/plugins/cesium-vue/src/components/echarts-pro/index.ts +7 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +107 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +12 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +55 -0
- package/plugins/cesium-vue/src/components/marker-bubble/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +235 -0
- package/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +35 -0
- package/plugins/cesium-vue/src/components/marker-default/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +19 -0
- package/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +12 -0
- package/plugins/cesium-vue/src/components/marker-html/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +21 -0
- package/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +12 -0
- package/plugins/cesium-vue/src/components/marker-manage/index.ts +9 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +106 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +8 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +466 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +148 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +45 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +75 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +154 -0
- package/plugins/cesium-vue/src/components/marker-text/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +14 -0
- package/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +10 -0
- package/plugins/cesium-vue/src/components/measurement/index.ts +7 -0
- package/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +183 -0
- package/plugins/cesium-vue/src/components/measurement/src/measurement.ts +20 -0
- package/plugins/cesium-vue/src/index.ts +89 -0
- package/plugins/cesium-vue/stats.html +4949 -0
- package/plugins/cesium-vue/tsconfig.json +18 -0
- package/plugins/cesium-vue/vite.config.ts +62 -0
- package/plugins/plugins/README.md +2 -0
- package/plugins/plugins/build.cjs +63 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs +5881 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs.map +1 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js +77 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -0
- package/plugins/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +73 -0
- package/plugins/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +152 -0
- package/plugins/plugins/cesium-core/dist/components/MarkerEvent.d.ts +38 -0
- package/plugins/plugins/cesium-core/dist/components/Material/MaterialManager.d.ts +49 -0
- package/plugins/plugins/cesium-core/dist/components/Material/help/PolylineFlowMaterialProperty.d.ts +10 -0
- package/plugins/plugins/cesium-core/dist/components/Material/help/dynamicImgMaterial.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/Material/index.d.ts +3 -0
- package/plugins/plugins/cesium-core/dist/components/TooltipManager.d.ts +11 -0
- package/plugins/plugins/cesium-core/dist/components/draw/DrawTool.d.ts +10 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/CircleDrawer.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +14 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PointDrawer.d.ts +12 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +14 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/RectangleDrawer.d.ts +13 -0
- package/plugins/plugins/cesium-core/dist/components/draw/types.d.ts +29 -0
- package/plugins/plugins/cesium-core/dist/components/entity/EntityLayer.d.ts +65 -0
- package/plugins/plugins/cesium-core/dist/components/gltf/GLTFManage.d.ts +141 -0
- package/plugins/plugins/cesium-core/dist/components/gltf/index.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/MeasurementTool.d.ts +34 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CircleMeasure.d.ts +21 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CoordinateMeasure.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +25 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +24 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RectangleMeasure.d.ts +22 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RegularPolygonMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/SpaceMeasure.d.ts +20 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TerrainHeightMeasure.d.ts +18 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TriangleMeasure.d.ts +24 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/VerticalMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/index.d.ts +13 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/types.d.ts +42 -0
- package/plugins/plugins/cesium-core/dist/components/primitive/PrimitiveManager.d.ts +50 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/CameraRoamTool.d.ts +27 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/PathRoamTool.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/index.d.ts +3 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/types.d.ts +66 -0
- package/plugins/plugins/cesium-core/dist/components/utils/convertGeoJsonToEntityData.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/components/utils/uuid.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/index.d.ts +12 -0
- package/plugins/plugins/cesium-core/package.json +26 -0
- package/plugins/plugins/cesium-core/pnpm-lock.yaml +872 -0
- package/plugins/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +546 -0
- package/plugins/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +489 -0
- package/plugins/plugins/cesium-core/src/components/MarkerEvent.ts +92 -0
- package/plugins/plugins/cesium-core/src/components/Material/MaterialManager.ts +129 -0
- package/plugins/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +116 -0
- package/plugins/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +236 -0
- package/plugins/plugins/cesium-core/src/components/Material/index.ts +3 -0
- package/plugins/plugins/cesium-core/src/components/TooltipManager.ts +52 -0
- package/plugins/plugins/cesium-core/src/components/draw/DrawTool.ts +55 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +159 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +113 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +70 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +112 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +115 -0
- package/plugins/plugins/cesium-core/src/components/draw/types.ts +28 -0
- package/plugins/plugins/cesium-core/src/components/entity/EntityLayer.ts +453 -0
- package/plugins/plugins/cesium-core/src/components/gltf/GLTFManage.ts +799 -0
- package/plugins/plugins/cesium-core/src/components/gltf/index.ts +1 -0
- package/plugins/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +416 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +451 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +267 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +139 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +418 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +352 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +388 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +379 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +246 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +185 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +541 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +360 -0
- package/plugins/plugins/cesium-core/src/components/measurement/index.ts +13 -0
- package/plugins/plugins/cesium-core/src/components/measurement/types.ts +57 -0
- package/plugins/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +556 -0
- package/plugins/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +286 -0
- package/plugins/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +174 -0
- package/plugins/plugins/cesium-core/src/components/roaming/index.ts +3 -0
- package/plugins/plugins/cesium-core/src/components/roaming/types.ts +71 -0
- package/plugins/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +98 -0
- package/plugins/plugins/cesium-core/src/components/utils/uuid.ts +7 -0
- package/plugins/plugins/cesium-core/src/index.ts +17 -0
- package/plugins/plugins/cesium-core/src/test/measurement/index.html +166 -0
- package/plugins/plugins/cesium-core/src/test/roaming/c.gltf +1 -0
- package/plugins/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/plugins/cesium-core/src/test/roaming/index.html +51 -0
- package/plugins/plugins/cesium-core/src/test/roaming/path.html +448 -0
- package/plugins/plugins/cesium-core/src/test/roaming/view.html +520 -0
- package/plugins/plugins/cesium-core/stats.html +4949 -0
- package/plugins/plugins/cesium-core/tsconfig.json +14 -0
- package/plugins/plugins/cesium-core/vite.config.ts +35 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts +18 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts +92 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts +82 -0
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts +152 -0
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts +21 -0
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts +69 -0
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts +21 -0
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts +68 -0
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts +78 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts +48 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts +48 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts +164 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts +30 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts +78 -0
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts +82 -0
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts +67 -0
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.css +1 -0
- package/plugins/plugins/cesium-vue/dist/index.d.ts +30 -0
- package/plugins/plugins/cesium-vue/dist/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.js +10087 -0
- package/plugins/plugins/cesium-vue/dist/index.js.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs +46 -0
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs.map +1 -0
- package/plugins/plugins/cesium-vue/package.json +48 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-001.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-002.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-003.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-004.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-005.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-006.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-007.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-008.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-009.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-010.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-011.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-012.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/img/Card3-BG.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/img/card_bg3.png +0 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/index.ts +11 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +110 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +6 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +99 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +13 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/index.ts +4 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/CameraRoam.vue +434 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/cameraRoam.ts +28 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +124 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +60 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +41 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +22 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +102 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +37 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +15 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +6 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +107 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +55 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +235 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +35 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +19 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +21 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/index.ts +14 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +106 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +8 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +466 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +148 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +45 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +75 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +154 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +14 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +10 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +183 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/src/measurement.ts +20 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/index.ts +4 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/PathRoam.vue +429 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/pathRoam.ts +28 -0
- package/plugins/plugins/cesium-vue/src/components/test/CardMarker.vue +150 -0
- package/plugins/plugins/cesium-vue/src/components/test/CesiumMarker.vue +34 -0
- package/plugins/plugins/cesium-vue/src/components/test/CesiumViewer.vue +77 -0
- package/plugins/plugins/cesium-vue/src/components/test/MyLabel.vue +25 -0
- package/plugins/plugins/cesium-vue/src/components/test/index.ts +28 -0
- package/plugins/plugins/cesium-vue/src/index.ts +83 -0
- package/plugins/plugins/cesium-vue/stats.html +4949 -0
- package/plugins/plugins/cesium-vue/tsconfig.json +18 -0
- package/plugins/plugins/cesium-vue/vite.config.ts +56 -0
- package/plugins/plugins/theme-chalk/dist/theme-chalk.css +819 -0
- package/plugins/plugins/theme-chalk/index.less +11 -0
- package/plugins/plugins/theme-chalk/package.json +27 -0
- package/plugins/plugins/theme-chalk/src/basicAudio.less +41 -0
- package/plugins/plugins/theme-chalk/src/basicVideo.less +17 -0
- package/plugins/plugins/theme-chalk/src/cameraRoam.less +239 -0
- package/plugins/plugins/theme-chalk/src/cardCarousel.less +71 -0
- package/plugins/plugins/theme-chalk/src/cardContent.less +73 -0
- package/plugins/plugins/theme-chalk/src/cardPage.less +61 -0
- package/plugins/plugins/theme-chalk/src/carouselImg.less +34 -0
- package/plugins/plugins/theme-chalk/src/marker.less +107 -0
- package/plugins/plugins/theme-chalk/src/markerManage.less +25 -0
- package/plugins/plugins/theme-chalk/src/measurement.less +106 -0
- package/plugins/plugins/theme-chalk/src/mixins/config.less +4 -0
- package/plugins/plugins/theme-chalk/src/mixins/mixins.less +64 -0
- package/plugins/plugins/theme-chalk/src/pathRoam.less +198 -0
- package/plugins/plugins/utils/create.ts +45 -0
- package/plugins/plugins/utils/package.json +12 -0
- package/plugins/plugins/utils/uuid.ts +43 -0
- package/plugins/plugins/utils/with-install.ts +10 -0
- package/plugins/theme-chalk/dist/theme-chalk.css +852 -0
- package/plugins/theme-chalk/index.less +11 -0
- package/plugins/theme-chalk/package.json +27 -0
- package/plugins/theme-chalk/src/basicAudio.less +44 -0
- package/plugins/theme-chalk/src/basicVideo.less +17 -0
- package/plugins/theme-chalk/src/cameraRoam.less +239 -0
- package/plugins/theme-chalk/src/cardCarousel.less +71 -0
- package/plugins/theme-chalk/src/cardContent.less +73 -0
- package/plugins/theme-chalk/src/cardPage.less +61 -0
- package/plugins/theme-chalk/src/carouselImg.less +66 -0
- package/plugins/theme-chalk/src/marker.less +107 -0
- package/plugins/theme-chalk/src/markerManage.less +25 -0
- package/plugins/theme-chalk/src/measurement.less +106 -0
- package/plugins/theme-chalk/src/mixins/config.less +4 -0
- package/plugins/theme-chalk/src/mixins/mixins.less +64 -0
- package/plugins/theme-chalk/src/pathRoam.less +198 -0
- package/plugins/utils/create.ts +45 -0
- package/plugins/utils/package.json +12 -0
- package/plugins/utils/uuid.ts +43 -0
- package/plugins/utils/with-install.ts +10 -0
|
@@ -0,0 +1,1295 @@
|
|
|
1
|
+
import { p as X, c as $, w as N } from "../create-DynflqE1.js";
|
|
2
|
+
import { defineComponent as W, ref as S, onMounted as Q, onBeforeUnmount as Y, createElementBlock as Z, openBlock as K, normalizeClass as k, unref as I, createElementVNode as b, withDirectives as E, toDisplayString as P, vModelText as V } from "vue";
|
|
3
|
+
import { c as H } from "../_commonjsHelpers-DaMA6jEr.js";
|
|
4
|
+
var F = {};
|
|
5
|
+
/*!
|
|
6
|
+
* howler.js v2.2.4
|
|
7
|
+
* howlerjs.com
|
|
8
|
+
*
|
|
9
|
+
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
10
|
+
* goldfirestudios.com
|
|
11
|
+
*
|
|
12
|
+
* MIT License
|
|
13
|
+
*/
|
|
14
|
+
var C;
|
|
15
|
+
function J() {
|
|
16
|
+
return C || (C = 1, (function(O) {
|
|
17
|
+
(function() {
|
|
18
|
+
var g = function() {
|
|
19
|
+
this.init();
|
|
20
|
+
};
|
|
21
|
+
g.prototype = {
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the global Howler object.
|
|
24
|
+
* @return {Howler}
|
|
25
|
+
*/
|
|
26
|
+
init: function() {
|
|
27
|
+
var e = this || r;
|
|
28
|
+
return e._counter = 1e3, e._html5AudioPool = [], e.html5PoolSize = 10, e._codecs = {}, e._howls = [], e._muted = !1, e._volume = 1, e._canPlayEvent = "canplaythrough", e._navigator = typeof window < "u" && window.navigator ? window.navigator : null, e.masterGain = null, e.noAudio = !1, e.usingWebAudio = !0, e.autoSuspend = !0, e.ctx = null, e.autoUnlock = !0, e._setup(), e;
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Get/set the global volume for all sounds.
|
|
32
|
+
* @param {Float} vol Volume from 0.0 to 1.0.
|
|
33
|
+
* @return {Howler/Float} Returns self or current volume.
|
|
34
|
+
*/
|
|
35
|
+
volume: function(e) {
|
|
36
|
+
var t = this || r;
|
|
37
|
+
if (e = parseFloat(e), t.ctx || A(), typeof e < "u" && e >= 0 && e <= 1) {
|
|
38
|
+
if (t._volume = e, t._muted)
|
|
39
|
+
return t;
|
|
40
|
+
t.usingWebAudio && t.masterGain.gain.setValueAtTime(e, r.ctx.currentTime);
|
|
41
|
+
for (var n = 0; n < t._howls.length; n++)
|
|
42
|
+
if (!t._howls[n]._webAudio)
|
|
43
|
+
for (var o = t._howls[n]._getSoundIds(), l = 0; l < o.length; l++) {
|
|
44
|
+
var s = t._howls[n]._soundById(o[l]);
|
|
45
|
+
s && s._node && (s._node.volume = s._volume * e);
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
return t._volume;
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Handle muting and unmuting globally.
|
|
53
|
+
* @param {Boolean} muted Is muted or not.
|
|
54
|
+
*/
|
|
55
|
+
mute: function(e) {
|
|
56
|
+
var t = this || r;
|
|
57
|
+
t.ctx || A(), t._muted = e, t.usingWebAudio && t.masterGain.gain.setValueAtTime(e ? 0 : t._volume, r.ctx.currentTime);
|
|
58
|
+
for (var n = 0; n < t._howls.length; n++)
|
|
59
|
+
if (!t._howls[n]._webAudio)
|
|
60
|
+
for (var o = t._howls[n]._getSoundIds(), l = 0; l < o.length; l++) {
|
|
61
|
+
var s = t._howls[n]._soundById(o[l]);
|
|
62
|
+
s && s._node && (s._node.muted = e ? !0 : s._muted);
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Handle stopping all sounds globally.
|
|
68
|
+
*/
|
|
69
|
+
stop: function() {
|
|
70
|
+
for (var e = this || r, t = 0; t < e._howls.length; t++)
|
|
71
|
+
e._howls[t].stop();
|
|
72
|
+
return e;
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Unload and destroy all currently loaded Howl objects.
|
|
76
|
+
* @return {Howler}
|
|
77
|
+
*/
|
|
78
|
+
unload: function() {
|
|
79
|
+
for (var e = this || r, t = e._howls.length - 1; t >= 0; t--)
|
|
80
|
+
e._howls[t].unload();
|
|
81
|
+
return e.usingWebAudio && e.ctx && typeof e.ctx.close < "u" && (e.ctx.close(), e.ctx = null, A()), e;
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Check for codec support of specific extension.
|
|
85
|
+
* @param {String} ext Audio file extention.
|
|
86
|
+
* @return {Boolean}
|
|
87
|
+
*/
|
|
88
|
+
codecs: function(e) {
|
|
89
|
+
return (this || r)._codecs[e.replace(/^x-/, "")];
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Setup various state values for global tracking.
|
|
93
|
+
* @return {Howler}
|
|
94
|
+
*/
|
|
95
|
+
_setup: function() {
|
|
96
|
+
var e = this || r;
|
|
97
|
+
if (e.state = e.ctx && e.ctx.state || "suspended", e._autoSuspend(), !e.usingWebAudio)
|
|
98
|
+
if (typeof Audio < "u")
|
|
99
|
+
try {
|
|
100
|
+
var t = new Audio();
|
|
101
|
+
typeof t.oncanplaythrough > "u" && (e._canPlayEvent = "canplay");
|
|
102
|
+
} catch {
|
|
103
|
+
e.noAudio = !0;
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
e.noAudio = !0;
|
|
107
|
+
try {
|
|
108
|
+
var t = new Audio();
|
|
109
|
+
t.muted && (e.noAudio = !0);
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
return e.noAudio || e._setupCodecs(), e;
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Check for browser support for various codecs and cache the results.
|
|
116
|
+
* @return {Howler}
|
|
117
|
+
*/
|
|
118
|
+
_setupCodecs: function() {
|
|
119
|
+
var e = this || r, t = null;
|
|
120
|
+
try {
|
|
121
|
+
t = typeof Audio < "u" ? new Audio() : null;
|
|
122
|
+
} catch {
|
|
123
|
+
return e;
|
|
124
|
+
}
|
|
125
|
+
if (!t || typeof t.canPlayType != "function")
|
|
126
|
+
return e;
|
|
127
|
+
var n = t.canPlayType("audio/mpeg;").replace(/^no$/, ""), o = e._navigator ? e._navigator.userAgent : "", l = o.match(/OPR\/(\d+)/g), s = l && parseInt(l[0].split("/")[1], 10) < 33, a = o.indexOf("Safari") !== -1 && o.indexOf("Chrome") === -1, _ = o.match(/Version\/(.*?) /), m = a && _ && parseInt(_[1], 10) < 15;
|
|
128
|
+
return e._codecs = {
|
|
129
|
+
mp3: !!(!s && (n || t.canPlayType("audio/mp3;").replace(/^no$/, ""))),
|
|
130
|
+
mpeg: !!n,
|
|
131
|
+
opus: !!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
|
|
132
|
+
ogg: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
|
|
133
|
+
oga: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
|
|
134
|
+
wav: !!(t.canPlayType('audio/wav; codecs="1"') || t.canPlayType("audio/wav")).replace(/^no$/, ""),
|
|
135
|
+
aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""),
|
|
136
|
+
caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""),
|
|
137
|
+
m4a: !!(t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/m4a;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
|
|
138
|
+
m4b: !!(t.canPlayType("audio/x-m4b;") || t.canPlayType("audio/m4b;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
|
|
139
|
+
mp4: !!(t.canPlayType("audio/x-mp4;") || t.canPlayType("audio/mp4;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
|
|
140
|
+
weba: !!(!m && t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
|
|
141
|
+
webm: !!(!m && t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
|
|
142
|
+
dolby: !!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""),
|
|
143
|
+
flac: !!(t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;")).replace(/^no$/, "")
|
|
144
|
+
}, e;
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* Some browsers/devices will only allow audio to be played after a user interaction.
|
|
148
|
+
* Attempt to automatically unlock audio on the first user interaction.
|
|
149
|
+
* Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
|
|
150
|
+
* @return {Howler}
|
|
151
|
+
*/
|
|
152
|
+
_unlockAudio: function() {
|
|
153
|
+
var e = this || r;
|
|
154
|
+
if (!(e._audioUnlocked || !e.ctx)) {
|
|
155
|
+
e._audioUnlocked = !1, e.autoUnlock = !1, !e._mobileUnloaded && e.ctx.sampleRate !== 44100 && (e._mobileUnloaded = !0, e.unload()), e._scratchBuffer = e.ctx.createBuffer(1, 1, 22050);
|
|
156
|
+
var t = function(n) {
|
|
157
|
+
for (; e._html5AudioPool.length < e.html5PoolSize; )
|
|
158
|
+
try {
|
|
159
|
+
var o = new Audio();
|
|
160
|
+
o._unlocked = !0, e._releaseHtml5Audio(o);
|
|
161
|
+
} catch {
|
|
162
|
+
e.noAudio = !0;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
for (var l = 0; l < e._howls.length; l++)
|
|
166
|
+
if (!e._howls[l]._webAudio)
|
|
167
|
+
for (var s = e._howls[l]._getSoundIds(), a = 0; a < s.length; a++) {
|
|
168
|
+
var _ = e._howls[l]._soundById(s[a]);
|
|
169
|
+
_ && _._node && !_._node._unlocked && (_._node._unlocked = !0, _._node.load());
|
|
170
|
+
}
|
|
171
|
+
e._autoResume();
|
|
172
|
+
var m = e.ctx.createBufferSource();
|
|
173
|
+
m.buffer = e._scratchBuffer, m.connect(e.ctx.destination), typeof m.start > "u" ? m.noteOn(0) : m.start(0), typeof e.ctx.resume == "function" && e.ctx.resume(), m.onended = function() {
|
|
174
|
+
m.disconnect(0), e._audioUnlocked = !0, document.removeEventListener("touchstart", t, !0), document.removeEventListener("touchend", t, !0), document.removeEventListener("click", t, !0), document.removeEventListener("keydown", t, !0);
|
|
175
|
+
for (var y = 0; y < e._howls.length; y++)
|
|
176
|
+
e._howls[y]._emit("unlock");
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
return document.addEventListener("touchstart", t, !0), document.addEventListener("touchend", t, !0), document.addEventListener("click", t, !0), document.addEventListener("keydown", t, !0), e;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Get an unlocked HTML5 Audio object from the pool. If none are left,
|
|
184
|
+
* return a new Audio object and throw a warning.
|
|
185
|
+
* @return {Audio} HTML5 Audio object.
|
|
186
|
+
*/
|
|
187
|
+
_obtainHtml5Audio: function() {
|
|
188
|
+
var e = this || r;
|
|
189
|
+
if (e._html5AudioPool.length)
|
|
190
|
+
return e._html5AudioPool.pop();
|
|
191
|
+
var t = new Audio().play();
|
|
192
|
+
return t && typeof Promise < "u" && (t instanceof Promise || typeof t.then == "function") && t.catch(function() {
|
|
193
|
+
console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.");
|
|
194
|
+
}), new Audio();
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Return an activated HTML5 Audio object to the pool.
|
|
198
|
+
* @return {Howler}
|
|
199
|
+
*/
|
|
200
|
+
_releaseHtml5Audio: function(e) {
|
|
201
|
+
var t = this || r;
|
|
202
|
+
return e._unlocked && t._html5AudioPool.push(e), t;
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds.
|
|
206
|
+
* This saves processing/energy and fixes various browser-specific bugs with audio getting stuck.
|
|
207
|
+
* @return {Howler}
|
|
208
|
+
*/
|
|
209
|
+
_autoSuspend: function() {
|
|
210
|
+
var e = this;
|
|
211
|
+
if (!(!e.autoSuspend || !e.ctx || typeof e.ctx.suspend > "u" || !r.usingWebAudio)) {
|
|
212
|
+
for (var t = 0; t < e._howls.length; t++)
|
|
213
|
+
if (e._howls[t]._webAudio) {
|
|
214
|
+
for (var n = 0; n < e._howls[t]._sounds.length; n++)
|
|
215
|
+
if (!e._howls[t]._sounds[n]._paused)
|
|
216
|
+
return e;
|
|
217
|
+
}
|
|
218
|
+
return e._suspendTimer && clearTimeout(e._suspendTimer), e._suspendTimer = setTimeout(function() {
|
|
219
|
+
if (e.autoSuspend) {
|
|
220
|
+
e._suspendTimer = null, e.state = "suspending";
|
|
221
|
+
var o = function() {
|
|
222
|
+
e.state = "suspended", e._resumeAfterSuspend && (delete e._resumeAfterSuspend, e._autoResume());
|
|
223
|
+
};
|
|
224
|
+
e.ctx.suspend().then(o, o);
|
|
225
|
+
}
|
|
226
|
+
}, 3e4), e;
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
/**
|
|
230
|
+
* Automatically resume the Web Audio AudioContext when a new sound is played.
|
|
231
|
+
* @return {Howler}
|
|
232
|
+
*/
|
|
233
|
+
_autoResume: function() {
|
|
234
|
+
var e = this;
|
|
235
|
+
if (!(!e.ctx || typeof e.ctx.resume > "u" || !r.usingWebAudio))
|
|
236
|
+
return e.state === "running" && e.ctx.state !== "interrupted" && e._suspendTimer ? (clearTimeout(e._suspendTimer), e._suspendTimer = null) : e.state === "suspended" || e.state === "running" && e.ctx.state === "interrupted" ? (e.ctx.resume().then(function() {
|
|
237
|
+
e.state = "running";
|
|
238
|
+
for (var t = 0; t < e._howls.length; t++)
|
|
239
|
+
e._howls[t]._emit("resume");
|
|
240
|
+
}), e._suspendTimer && (clearTimeout(e._suspendTimer), e._suspendTimer = null)) : e.state === "suspending" && (e._resumeAfterSuspend = !0), e;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
var r = new g(), i = function(e) {
|
|
244
|
+
var t = this;
|
|
245
|
+
if (!e.src || e.src.length === 0) {
|
|
246
|
+
console.error("An array of source files must be passed with any new Howl.");
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
t.init(e);
|
|
250
|
+
};
|
|
251
|
+
i.prototype = {
|
|
252
|
+
/**
|
|
253
|
+
* Initialize a new Howl group object.
|
|
254
|
+
* @param {Object} o Passed in properties for this group.
|
|
255
|
+
* @return {Howl}
|
|
256
|
+
*/
|
|
257
|
+
init: function(e) {
|
|
258
|
+
var t = this;
|
|
259
|
+
return r.ctx || A(), t._autoplay = e.autoplay || !1, t._format = typeof e.format != "string" ? e.format : [e.format], t._html5 = e.html5 || !1, t._muted = e.mute || !1, t._loop = e.loop || !1, t._pool = e.pool || 5, t._preload = typeof e.preload == "boolean" || e.preload === "metadata" ? e.preload : !0, t._rate = e.rate || 1, t._sprite = e.sprite || {}, t._src = typeof e.src != "string" ? e.src : [e.src], t._volume = e.volume !== void 0 ? e.volume : 1, t._xhr = {
|
|
260
|
+
method: e.xhr && e.xhr.method ? e.xhr.method : "GET",
|
|
261
|
+
headers: e.xhr && e.xhr.headers ? e.xhr.headers : null,
|
|
262
|
+
withCredentials: e.xhr && e.xhr.withCredentials ? e.xhr.withCredentials : !1
|
|
263
|
+
}, t._duration = 0, t._state = "unloaded", t._sounds = [], t._endTimers = {}, t._queue = [], t._playLock = !1, t._onend = e.onend ? [{ fn: e.onend }] : [], t._onfade = e.onfade ? [{ fn: e.onfade }] : [], t._onload = e.onload ? [{ fn: e.onload }] : [], t._onloaderror = e.onloaderror ? [{ fn: e.onloaderror }] : [], t._onplayerror = e.onplayerror ? [{ fn: e.onplayerror }] : [], t._onpause = e.onpause ? [{ fn: e.onpause }] : [], t._onplay = e.onplay ? [{ fn: e.onplay }] : [], t._onstop = e.onstop ? [{ fn: e.onstop }] : [], t._onmute = e.onmute ? [{ fn: e.onmute }] : [], t._onvolume = e.onvolume ? [{ fn: e.onvolume }] : [], t._onrate = e.onrate ? [{ fn: e.onrate }] : [], t._onseek = e.onseek ? [{ fn: e.onseek }] : [], t._onunlock = e.onunlock ? [{ fn: e.onunlock }] : [], t._onresume = [], t._webAudio = r.usingWebAudio && !t._html5, typeof r.ctx < "u" && r.ctx && r.autoUnlock && r._unlockAudio(), r._howls.push(t), t._autoplay && t._queue.push({
|
|
264
|
+
event: "play",
|
|
265
|
+
action: function() {
|
|
266
|
+
t.play();
|
|
267
|
+
}
|
|
268
|
+
}), t._preload && t._preload !== "none" && t.load(), t;
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* Load the audio file.
|
|
272
|
+
* @return {Howler}
|
|
273
|
+
*/
|
|
274
|
+
load: function() {
|
|
275
|
+
var e = this, t = null;
|
|
276
|
+
if (r.noAudio) {
|
|
277
|
+
e._emit("loaderror", null, "No audio support.");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
typeof e._src == "string" && (e._src = [e._src]);
|
|
281
|
+
for (var n = 0; n < e._src.length; n++) {
|
|
282
|
+
var o, l;
|
|
283
|
+
if (e._format && e._format[n])
|
|
284
|
+
o = e._format[n];
|
|
285
|
+
else {
|
|
286
|
+
if (l = e._src[n], typeof l != "string") {
|
|
287
|
+
e._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
o = /^data:audio\/([^;,]+);/i.exec(l), o || (o = /\.([^.]+)$/.exec(l.split("?", 1)[0])), o && (o = o[1].toLowerCase());
|
|
291
|
+
}
|
|
292
|
+
if (o || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), o && r.codecs(o)) {
|
|
293
|
+
t = e._src[n];
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (!t) {
|
|
298
|
+
e._emit("loaderror", null, "No codec support for selected audio sources.");
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
return e._src = t, e._state = "loading", window.location.protocol === "https:" && t.slice(0, 5) === "http:" && (e._html5 = !0, e._webAudio = !1), new u(e), e._webAudio && d(e), e;
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* Play a sound or resume previous playback.
|
|
305
|
+
* @param {String/Number} sprite Sprite name for sprite playback or sound id to continue previous.
|
|
306
|
+
* @param {Boolean} internal Internal Use: true prevents event firing.
|
|
307
|
+
* @return {Number} Sound ID.
|
|
308
|
+
*/
|
|
309
|
+
play: function(e, t) {
|
|
310
|
+
var n = this, o = null;
|
|
311
|
+
if (typeof e == "number")
|
|
312
|
+
o = e, e = null;
|
|
313
|
+
else {
|
|
314
|
+
if (typeof e == "string" && n._state === "loaded" && !n._sprite[e])
|
|
315
|
+
return null;
|
|
316
|
+
if (typeof e > "u" && (e = "__default", !n._playLock)) {
|
|
317
|
+
for (var l = 0, s = 0; s < n._sounds.length; s++)
|
|
318
|
+
n._sounds[s]._paused && !n._sounds[s]._ended && (l++, o = n._sounds[s]._id);
|
|
319
|
+
l === 1 ? e = null : o = null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
var a = o ? n._soundById(o) : n._inactiveSound();
|
|
323
|
+
if (!a)
|
|
324
|
+
return null;
|
|
325
|
+
if (o && !e && (e = a._sprite || "__default"), n._state !== "loaded") {
|
|
326
|
+
a._sprite = e, a._ended = !1;
|
|
327
|
+
var _ = a._id;
|
|
328
|
+
return n._queue.push({
|
|
329
|
+
event: "play",
|
|
330
|
+
action: function() {
|
|
331
|
+
n.play(_);
|
|
332
|
+
}
|
|
333
|
+
}), _;
|
|
334
|
+
}
|
|
335
|
+
if (o && !a._paused)
|
|
336
|
+
return t || n._loadQueue("play"), a._id;
|
|
337
|
+
n._webAudio && r._autoResume();
|
|
338
|
+
var m = Math.max(0, a._seek > 0 ? a._seek : n._sprite[e][0] / 1e3), y = Math.max(0, (n._sprite[e][0] + n._sprite[e][1]) / 1e3 - m), w = y * 1e3 / Math.abs(a._rate), T = n._sprite[e][0] / 1e3, M = (n._sprite[e][0] + n._sprite[e][1]) / 1e3;
|
|
339
|
+
a._sprite = e, a._ended = !1;
|
|
340
|
+
var B = function() {
|
|
341
|
+
a._paused = !1, a._seek = m, a._start = T, a._stop = M, a._loop = !!(a._loop || n._sprite[e][2]);
|
|
342
|
+
};
|
|
343
|
+
if (m >= M) {
|
|
344
|
+
n._ended(a);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
var h = a._node;
|
|
348
|
+
if (n._webAudio) {
|
|
349
|
+
var L = function() {
|
|
350
|
+
n._playLock = !1, B(), n._refreshBuffer(a);
|
|
351
|
+
var x = a._muted || n._muted ? 0 : a._volume;
|
|
352
|
+
h.gain.setValueAtTime(x, r.ctx.currentTime), a._playStart = r.ctx.currentTime, typeof h.bufferSource.start > "u" ? a._loop ? h.bufferSource.noteGrainOn(0, m, 86400) : h.bufferSource.noteGrainOn(0, m, y) : a._loop ? h.bufferSource.start(0, m, 86400) : h.bufferSource.start(0, m, y), w !== 1 / 0 && (n._endTimers[a._id] = setTimeout(n._ended.bind(n, a), w)), t || setTimeout(function() {
|
|
353
|
+
n._emit("play", a._id), n._loadQueue();
|
|
354
|
+
}, 0);
|
|
355
|
+
};
|
|
356
|
+
r.state === "running" && r.ctx.state !== "interrupted" ? L() : (n._playLock = !0, n.once("resume", L), n._clearTimer(a._id));
|
|
357
|
+
} else {
|
|
358
|
+
var D = function() {
|
|
359
|
+
h.currentTime = m, h.muted = a._muted || n._muted || r._muted || h.muted, h.volume = a._volume * r.volume(), h.playbackRate = a._rate;
|
|
360
|
+
try {
|
|
361
|
+
var x = h.play();
|
|
362
|
+
if (x && typeof Promise < "u" && (x instanceof Promise || typeof x.then == "function") ? (n._playLock = !0, B(), x.then(function() {
|
|
363
|
+
n._playLock = !1, h._unlocked = !0, t ? n._loadQueue() : n._emit("play", a._id);
|
|
364
|
+
}).catch(function() {
|
|
365
|
+
n._playLock = !1, n._emit("playerror", a._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), a._ended = !0, a._paused = !0;
|
|
366
|
+
})) : t || (n._playLock = !1, B(), n._emit("play", a._id)), h.playbackRate = a._rate, h.paused) {
|
|
367
|
+
n._emit("playerror", a._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
e !== "__default" || a._loop ? n._endTimers[a._id] = setTimeout(n._ended.bind(n, a), w) : (n._endTimers[a._id] = function() {
|
|
371
|
+
n._ended(a), h.removeEventListener("ended", n._endTimers[a._id], !1);
|
|
372
|
+
}, h.addEventListener("ended", n._endTimers[a._id], !1));
|
|
373
|
+
} catch (R) {
|
|
374
|
+
n._emit("playerror", a._id, R);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
h.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (h.src = n._src, h.load());
|
|
378
|
+
var q = window && window.ejecta || !h.readyState && r._navigator.isCocoonJS;
|
|
379
|
+
if (h.readyState >= 3 || q)
|
|
380
|
+
D();
|
|
381
|
+
else {
|
|
382
|
+
n._playLock = !0, n._state = "loading";
|
|
383
|
+
var G = function() {
|
|
384
|
+
n._state = "loaded", D(), h.removeEventListener(r._canPlayEvent, G, !1);
|
|
385
|
+
};
|
|
386
|
+
h.addEventListener(r._canPlayEvent, G, !1), n._clearTimer(a._id);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return a._id;
|
|
390
|
+
},
|
|
391
|
+
/**
|
|
392
|
+
* Pause playback and save current position.
|
|
393
|
+
* @param {Number} id The sound ID (empty to pause all in group).
|
|
394
|
+
* @return {Howl}
|
|
395
|
+
*/
|
|
396
|
+
pause: function(e) {
|
|
397
|
+
var t = this;
|
|
398
|
+
if (t._state !== "loaded" || t._playLock)
|
|
399
|
+
return t._queue.push({
|
|
400
|
+
event: "pause",
|
|
401
|
+
action: function() {
|
|
402
|
+
t.pause(e);
|
|
403
|
+
}
|
|
404
|
+
}), t;
|
|
405
|
+
for (var n = t._getSoundIds(e), o = 0; o < n.length; o++) {
|
|
406
|
+
t._clearTimer(n[o]);
|
|
407
|
+
var l = t._soundById(n[o]);
|
|
408
|
+
if (l && !l._paused && (l._seek = t.seek(n[o]), l._rateSeek = 0, l._paused = !0, t._stopFade(n[o]), l._node))
|
|
409
|
+
if (t._webAudio) {
|
|
410
|
+
if (!l._node.bufferSource)
|
|
411
|
+
continue;
|
|
412
|
+
typeof l._node.bufferSource.stop > "u" ? l._node.bufferSource.noteOff(0) : l._node.bufferSource.stop(0), t._cleanBuffer(l._node);
|
|
413
|
+
} else (!isNaN(l._node.duration) || l._node.duration === 1 / 0) && l._node.pause();
|
|
414
|
+
arguments[1] || t._emit("pause", l ? l._id : null);
|
|
415
|
+
}
|
|
416
|
+
return t;
|
|
417
|
+
},
|
|
418
|
+
/**
|
|
419
|
+
* Stop playback and reset to start.
|
|
420
|
+
* @param {Number} id The sound ID (empty to stop all in group).
|
|
421
|
+
* @param {Boolean} internal Internal Use: true prevents event firing.
|
|
422
|
+
* @return {Howl}
|
|
423
|
+
*/
|
|
424
|
+
stop: function(e, t) {
|
|
425
|
+
var n = this;
|
|
426
|
+
if (n._state !== "loaded" || n._playLock)
|
|
427
|
+
return n._queue.push({
|
|
428
|
+
event: "stop",
|
|
429
|
+
action: function() {
|
|
430
|
+
n.stop(e);
|
|
431
|
+
}
|
|
432
|
+
}), n;
|
|
433
|
+
for (var o = n._getSoundIds(e), l = 0; l < o.length; l++) {
|
|
434
|
+
n._clearTimer(o[l]);
|
|
435
|
+
var s = n._soundById(o[l]);
|
|
436
|
+
s && (s._seek = s._start || 0, s._rateSeek = 0, s._paused = !0, s._ended = !0, n._stopFade(o[l]), s._node && (n._webAudio ? s._node.bufferSource && (typeof s._node.bufferSource.stop > "u" ? s._node.bufferSource.noteOff(0) : s._node.bufferSource.stop(0), n._cleanBuffer(s._node)) : (!isNaN(s._node.duration) || s._node.duration === 1 / 0) && (s._node.currentTime = s._start || 0, s._node.pause(), s._node.duration === 1 / 0 && n._clearSound(s._node))), t || n._emit("stop", s._id));
|
|
437
|
+
}
|
|
438
|
+
return n;
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* Mute/unmute a single sound or all sounds in this Howl group.
|
|
442
|
+
* @param {Boolean} muted Set to true to mute and false to unmute.
|
|
443
|
+
* @param {Number} id The sound ID to update (omit to mute/unmute all).
|
|
444
|
+
* @return {Howl}
|
|
445
|
+
*/
|
|
446
|
+
mute: function(e, t) {
|
|
447
|
+
var n = this;
|
|
448
|
+
if (n._state !== "loaded" || n._playLock)
|
|
449
|
+
return n._queue.push({
|
|
450
|
+
event: "mute",
|
|
451
|
+
action: function() {
|
|
452
|
+
n.mute(e, t);
|
|
453
|
+
}
|
|
454
|
+
}), n;
|
|
455
|
+
if (typeof t > "u")
|
|
456
|
+
if (typeof e == "boolean")
|
|
457
|
+
n._muted = e;
|
|
458
|
+
else
|
|
459
|
+
return n._muted;
|
|
460
|
+
for (var o = n._getSoundIds(t), l = 0; l < o.length; l++) {
|
|
461
|
+
var s = n._soundById(o[l]);
|
|
462
|
+
s && (s._muted = e, s._interval && n._stopFade(s._id), n._webAudio && s._node ? s._node.gain.setValueAtTime(e ? 0 : s._volume, r.ctx.currentTime) : s._node && (s._node.muted = r._muted ? !0 : e), n._emit("mute", s._id));
|
|
463
|
+
}
|
|
464
|
+
return n;
|
|
465
|
+
},
|
|
466
|
+
/**
|
|
467
|
+
* Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.
|
|
468
|
+
* volume() -> Returns the group's volume value.
|
|
469
|
+
* volume(id) -> Returns the sound id's current volume.
|
|
470
|
+
* volume(vol) -> Sets the volume of all sounds in this Howl group.
|
|
471
|
+
* volume(vol, id) -> Sets the volume of passed sound id.
|
|
472
|
+
* @return {Howl/Number} Returns self or current volume.
|
|
473
|
+
*/
|
|
474
|
+
volume: function() {
|
|
475
|
+
var e = this, t = arguments, n, o;
|
|
476
|
+
if (t.length === 0)
|
|
477
|
+
return e._volume;
|
|
478
|
+
if (t.length === 1 || t.length === 2 && typeof t[1] > "u") {
|
|
479
|
+
var l = e._getSoundIds(), s = l.indexOf(t[0]);
|
|
480
|
+
s >= 0 ? o = parseInt(t[0], 10) : n = parseFloat(t[0]);
|
|
481
|
+
} else t.length >= 2 && (n = parseFloat(t[0]), o = parseInt(t[1], 10));
|
|
482
|
+
var a;
|
|
483
|
+
if (typeof n < "u" && n >= 0 && n <= 1) {
|
|
484
|
+
if (e._state !== "loaded" || e._playLock)
|
|
485
|
+
return e._queue.push({
|
|
486
|
+
event: "volume",
|
|
487
|
+
action: function() {
|
|
488
|
+
e.volume.apply(e, t);
|
|
489
|
+
}
|
|
490
|
+
}), e;
|
|
491
|
+
typeof o > "u" && (e._volume = n), o = e._getSoundIds(o);
|
|
492
|
+
for (var _ = 0; _ < o.length; _++)
|
|
493
|
+
a = e._soundById(o[_]), a && (a._volume = n, t[2] || e._stopFade(o[_]), e._webAudio && a._node && !a._muted ? a._node.gain.setValueAtTime(n, r.ctx.currentTime) : a._node && !a._muted && (a._node.volume = n * r.volume()), e._emit("volume", a._id));
|
|
494
|
+
} else
|
|
495
|
+
return a = o ? e._soundById(o) : e._sounds[0], a ? a._volume : 0;
|
|
496
|
+
return e;
|
|
497
|
+
},
|
|
498
|
+
/**
|
|
499
|
+
* Fade a currently playing sound between two volumes (if no id is passed, all sounds will fade).
|
|
500
|
+
* @param {Number} from The value to fade from (0.0 to 1.0).
|
|
501
|
+
* @param {Number} to The volume to fade to (0.0 to 1.0).
|
|
502
|
+
* @param {Number} len Time in milliseconds to fade.
|
|
503
|
+
* @param {Number} id The sound id (omit to fade all sounds).
|
|
504
|
+
* @return {Howl}
|
|
505
|
+
*/
|
|
506
|
+
fade: function(e, t, n, o) {
|
|
507
|
+
var l = this;
|
|
508
|
+
if (l._state !== "loaded" || l._playLock)
|
|
509
|
+
return l._queue.push({
|
|
510
|
+
event: "fade",
|
|
511
|
+
action: function() {
|
|
512
|
+
l.fade(e, t, n, o);
|
|
513
|
+
}
|
|
514
|
+
}), l;
|
|
515
|
+
e = Math.min(Math.max(0, parseFloat(e)), 1), t = Math.min(Math.max(0, parseFloat(t)), 1), n = parseFloat(n), l.volume(e, o);
|
|
516
|
+
for (var s = l._getSoundIds(o), a = 0; a < s.length; a++) {
|
|
517
|
+
var _ = l._soundById(s[a]);
|
|
518
|
+
if (_) {
|
|
519
|
+
if (o || l._stopFade(s[a]), l._webAudio && !_._muted) {
|
|
520
|
+
var m = r.ctx.currentTime, y = m + n / 1e3;
|
|
521
|
+
_._volume = e, _._node.gain.setValueAtTime(e, m), _._node.gain.linearRampToValueAtTime(t, y);
|
|
522
|
+
}
|
|
523
|
+
l._startFadeInterval(_, e, t, n, s[a], typeof o > "u");
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return l;
|
|
527
|
+
},
|
|
528
|
+
/**
|
|
529
|
+
* Starts the internal interval to fade a sound.
|
|
530
|
+
* @param {Object} sound Reference to sound to fade.
|
|
531
|
+
* @param {Number} from The value to fade from (0.0 to 1.0).
|
|
532
|
+
* @param {Number} to The volume to fade to (0.0 to 1.0).
|
|
533
|
+
* @param {Number} len Time in milliseconds to fade.
|
|
534
|
+
* @param {Number} id The sound id to fade.
|
|
535
|
+
* @param {Boolean} isGroup If true, set the volume on the group.
|
|
536
|
+
*/
|
|
537
|
+
_startFadeInterval: function(e, t, n, o, l, s) {
|
|
538
|
+
var a = this, _ = t, m = n - t, y = Math.abs(m / 0.01), w = Math.max(4, y > 0 ? o / y : o), T = Date.now();
|
|
539
|
+
e._fadeTo = n, e._interval = setInterval(function() {
|
|
540
|
+
var M = (Date.now() - T) / o;
|
|
541
|
+
T = Date.now(), _ += m * M, _ = Math.round(_ * 100) / 100, m < 0 ? _ = Math.max(n, _) : _ = Math.min(n, _), a._webAudio ? e._volume = _ : a.volume(_, e._id, !0), s && (a._volume = _), (n < t && _ <= n || n > t && _ >= n) && (clearInterval(e._interval), e._interval = null, e._fadeTo = null, a.volume(n, e._id), a._emit("fade", e._id));
|
|
542
|
+
}, w);
|
|
543
|
+
},
|
|
544
|
+
/**
|
|
545
|
+
* Internal method that stops the currently playing fade when
|
|
546
|
+
* a new fade starts, volume is changed or the sound is stopped.
|
|
547
|
+
* @param {Number} id The sound id.
|
|
548
|
+
* @return {Howl}
|
|
549
|
+
*/
|
|
550
|
+
_stopFade: function(e) {
|
|
551
|
+
var t = this, n = t._soundById(e);
|
|
552
|
+
return n && n._interval && (t._webAudio && n._node.gain.cancelScheduledValues(r.ctx.currentTime), clearInterval(n._interval), n._interval = null, t.volume(n._fadeTo, e), n._fadeTo = null, t._emit("fade", e)), t;
|
|
553
|
+
},
|
|
554
|
+
/**
|
|
555
|
+
* Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.
|
|
556
|
+
* loop() -> Returns the group's loop value.
|
|
557
|
+
* loop(id) -> Returns the sound id's loop value.
|
|
558
|
+
* loop(loop) -> Sets the loop value for all sounds in this Howl group.
|
|
559
|
+
* loop(loop, id) -> Sets the loop value of passed sound id.
|
|
560
|
+
* @return {Howl/Boolean} Returns self or current loop value.
|
|
561
|
+
*/
|
|
562
|
+
loop: function() {
|
|
563
|
+
var e = this, t = arguments, n, o, l;
|
|
564
|
+
if (t.length === 0)
|
|
565
|
+
return e._loop;
|
|
566
|
+
if (t.length === 1)
|
|
567
|
+
if (typeof t[0] == "boolean")
|
|
568
|
+
n = t[0], e._loop = n;
|
|
569
|
+
else
|
|
570
|
+
return l = e._soundById(parseInt(t[0], 10)), l ? l._loop : !1;
|
|
571
|
+
else t.length === 2 && (n = t[0], o = parseInt(t[1], 10));
|
|
572
|
+
for (var s = e._getSoundIds(o), a = 0; a < s.length; a++)
|
|
573
|
+
l = e._soundById(s[a]), l && (l._loop = n, e._webAudio && l._node && l._node.bufferSource && (l._node.bufferSource.loop = n, n && (l._node.bufferSource.loopStart = l._start || 0, l._node.bufferSource.loopEnd = l._stop, e.playing(s[a]) && (e.pause(s[a], !0), e.play(s[a], !0)))));
|
|
574
|
+
return e;
|
|
575
|
+
},
|
|
576
|
+
/**
|
|
577
|
+
* Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.
|
|
578
|
+
* rate() -> Returns the first sound node's current playback rate.
|
|
579
|
+
* rate(id) -> Returns the sound id's current playback rate.
|
|
580
|
+
* rate(rate) -> Sets the playback rate of all sounds in this Howl group.
|
|
581
|
+
* rate(rate, id) -> Sets the playback rate of passed sound id.
|
|
582
|
+
* @return {Howl/Number} Returns self or the current playback rate.
|
|
583
|
+
*/
|
|
584
|
+
rate: function() {
|
|
585
|
+
var e = this, t = arguments, n, o;
|
|
586
|
+
if (t.length === 0)
|
|
587
|
+
o = e._sounds[0]._id;
|
|
588
|
+
else if (t.length === 1) {
|
|
589
|
+
var l = e._getSoundIds(), s = l.indexOf(t[0]);
|
|
590
|
+
s >= 0 ? o = parseInt(t[0], 10) : n = parseFloat(t[0]);
|
|
591
|
+
} else t.length === 2 && (n = parseFloat(t[0]), o = parseInt(t[1], 10));
|
|
592
|
+
var a;
|
|
593
|
+
if (typeof n == "number") {
|
|
594
|
+
if (e._state !== "loaded" || e._playLock)
|
|
595
|
+
return e._queue.push({
|
|
596
|
+
event: "rate",
|
|
597
|
+
action: function() {
|
|
598
|
+
e.rate.apply(e, t);
|
|
599
|
+
}
|
|
600
|
+
}), e;
|
|
601
|
+
typeof o > "u" && (e._rate = n), o = e._getSoundIds(o);
|
|
602
|
+
for (var _ = 0; _ < o.length; _++)
|
|
603
|
+
if (a = e._soundById(o[_]), a) {
|
|
604
|
+
e.playing(o[_]) && (a._rateSeek = e.seek(o[_]), a._playStart = e._webAudio ? r.ctx.currentTime : a._playStart), a._rate = n, e._webAudio && a._node && a._node.bufferSource ? a._node.bufferSource.playbackRate.setValueAtTime(n, r.ctx.currentTime) : a._node && (a._node.playbackRate = n);
|
|
605
|
+
var m = e.seek(o[_]), y = (e._sprite[a._sprite][0] + e._sprite[a._sprite][1]) / 1e3 - m, w = y * 1e3 / Math.abs(a._rate);
|
|
606
|
+
(e._endTimers[o[_]] || !a._paused) && (e._clearTimer(o[_]), e._endTimers[o[_]] = setTimeout(e._ended.bind(e, a), w)), e._emit("rate", a._id);
|
|
607
|
+
}
|
|
608
|
+
} else
|
|
609
|
+
return a = e._soundById(o), a ? a._rate : e._rate;
|
|
610
|
+
return e;
|
|
611
|
+
},
|
|
612
|
+
/**
|
|
613
|
+
* Get/set the seek position of a sound. This method can optionally take 0, 1 or 2 arguments.
|
|
614
|
+
* seek() -> Returns the first sound node's current seek position.
|
|
615
|
+
* seek(id) -> Returns the sound id's current seek position.
|
|
616
|
+
* seek(seek) -> Sets the seek position of the first sound node.
|
|
617
|
+
* seek(seek, id) -> Sets the seek position of passed sound id.
|
|
618
|
+
* @return {Howl/Number} Returns self or the current seek position.
|
|
619
|
+
*/
|
|
620
|
+
seek: function() {
|
|
621
|
+
var e = this, t = arguments, n, o;
|
|
622
|
+
if (t.length === 0)
|
|
623
|
+
e._sounds.length && (o = e._sounds[0]._id);
|
|
624
|
+
else if (t.length === 1) {
|
|
625
|
+
var l = e._getSoundIds(), s = l.indexOf(t[0]);
|
|
626
|
+
s >= 0 ? o = parseInt(t[0], 10) : e._sounds.length && (o = e._sounds[0]._id, n = parseFloat(t[0]));
|
|
627
|
+
} else t.length === 2 && (n = parseFloat(t[0]), o = parseInt(t[1], 10));
|
|
628
|
+
if (typeof o > "u")
|
|
629
|
+
return 0;
|
|
630
|
+
if (typeof n == "number" && (e._state !== "loaded" || e._playLock))
|
|
631
|
+
return e._queue.push({
|
|
632
|
+
event: "seek",
|
|
633
|
+
action: function() {
|
|
634
|
+
e.seek.apply(e, t);
|
|
635
|
+
}
|
|
636
|
+
}), e;
|
|
637
|
+
var a = e._soundById(o);
|
|
638
|
+
if (a)
|
|
639
|
+
if (typeof n == "number" && n >= 0) {
|
|
640
|
+
var _ = e.playing(o);
|
|
641
|
+
_ && e.pause(o, !0), a._seek = n, a._ended = !1, e._clearTimer(o), !e._webAudio && a._node && !isNaN(a._node.duration) && (a._node.currentTime = n);
|
|
642
|
+
var m = function() {
|
|
643
|
+
_ && e.play(o, !0), e._emit("seek", o);
|
|
644
|
+
};
|
|
645
|
+
if (_ && !e._webAudio) {
|
|
646
|
+
var y = function() {
|
|
647
|
+
e._playLock ? setTimeout(y, 0) : m();
|
|
648
|
+
};
|
|
649
|
+
setTimeout(y, 0);
|
|
650
|
+
} else
|
|
651
|
+
m();
|
|
652
|
+
} else if (e._webAudio) {
|
|
653
|
+
var w = e.playing(o) ? r.ctx.currentTime - a._playStart : 0, T = a._rateSeek ? a._rateSeek - a._seek : 0;
|
|
654
|
+
return a._seek + (T + w * Math.abs(a._rate));
|
|
655
|
+
} else
|
|
656
|
+
return a._node.currentTime;
|
|
657
|
+
return e;
|
|
658
|
+
},
|
|
659
|
+
/**
|
|
660
|
+
* Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.
|
|
661
|
+
* @param {Number} id The sound id to check. If none is passed, the whole sound group is checked.
|
|
662
|
+
* @return {Boolean} True if playing and false if not.
|
|
663
|
+
*/
|
|
664
|
+
playing: function(e) {
|
|
665
|
+
var t = this;
|
|
666
|
+
if (typeof e == "number") {
|
|
667
|
+
var n = t._soundById(e);
|
|
668
|
+
return n ? !n._paused : !1;
|
|
669
|
+
}
|
|
670
|
+
for (var o = 0; o < t._sounds.length; o++)
|
|
671
|
+
if (!t._sounds[o]._paused)
|
|
672
|
+
return !0;
|
|
673
|
+
return !1;
|
|
674
|
+
},
|
|
675
|
+
/**
|
|
676
|
+
* Get the duration of this sound. Passing a sound id will return the sprite duration.
|
|
677
|
+
* @param {Number} id The sound id to check. If none is passed, return full source duration.
|
|
678
|
+
* @return {Number} Audio duration in seconds.
|
|
679
|
+
*/
|
|
680
|
+
duration: function(e) {
|
|
681
|
+
var t = this, n = t._duration, o = t._soundById(e);
|
|
682
|
+
return o && (n = t._sprite[o._sprite][1] / 1e3), n;
|
|
683
|
+
},
|
|
684
|
+
/**
|
|
685
|
+
* Returns the current loaded state of this Howl.
|
|
686
|
+
* @return {String} 'unloaded', 'loading', 'loaded'
|
|
687
|
+
*/
|
|
688
|
+
state: function() {
|
|
689
|
+
return this._state;
|
|
690
|
+
},
|
|
691
|
+
/**
|
|
692
|
+
* Unload and destroy the current Howl object.
|
|
693
|
+
* This will immediately stop all sound instances attached to this group.
|
|
694
|
+
*/
|
|
695
|
+
unload: function() {
|
|
696
|
+
for (var e = this, t = e._sounds, n = 0; n < t.length; n++)
|
|
697
|
+
t[n]._paused || e.stop(t[n]._id), e._webAudio || (e._clearSound(t[n]._node), t[n]._node.removeEventListener("error", t[n]._errorFn, !1), t[n]._node.removeEventListener(r._canPlayEvent, t[n]._loadFn, !1), t[n]._node.removeEventListener("ended", t[n]._endFn, !1), r._releaseHtml5Audio(t[n]._node)), delete t[n]._node, e._clearTimer(t[n]._id);
|
|
698
|
+
var o = r._howls.indexOf(e);
|
|
699
|
+
o >= 0 && r._howls.splice(o, 1);
|
|
700
|
+
var l = !0;
|
|
701
|
+
for (n = 0; n < r._howls.length; n++)
|
|
702
|
+
if (r._howls[n]._src === e._src || e._src.indexOf(r._howls[n]._src) >= 0) {
|
|
703
|
+
l = !1;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
return c && l && delete c[e._src], r.noAudio = !1, e._state = "unloaded", e._sounds = [], e = null, null;
|
|
707
|
+
},
|
|
708
|
+
/**
|
|
709
|
+
* Listen to a custom event.
|
|
710
|
+
* @param {String} event Event name.
|
|
711
|
+
* @param {Function} fn Listener to call.
|
|
712
|
+
* @param {Number} id (optional) Only listen to events for this sound.
|
|
713
|
+
* @param {Number} once (INTERNAL) Marks event to fire only once.
|
|
714
|
+
* @return {Howl}
|
|
715
|
+
*/
|
|
716
|
+
on: function(e, t, n, o) {
|
|
717
|
+
var l = this, s = l["_on" + e];
|
|
718
|
+
return typeof t == "function" && s.push(o ? { id: n, fn: t, once: o } : { id: n, fn: t }), l;
|
|
719
|
+
},
|
|
720
|
+
/**
|
|
721
|
+
* Remove a custom event. Call without parameters to remove all events.
|
|
722
|
+
* @param {String} event Event name.
|
|
723
|
+
* @param {Function} fn Listener to remove. Leave empty to remove all.
|
|
724
|
+
* @param {Number} id (optional) Only remove events for this sound.
|
|
725
|
+
* @return {Howl}
|
|
726
|
+
*/
|
|
727
|
+
off: function(e, t, n) {
|
|
728
|
+
var o = this, l = o["_on" + e], s = 0;
|
|
729
|
+
if (typeof t == "number" && (n = t, t = null), t || n)
|
|
730
|
+
for (s = 0; s < l.length; s++) {
|
|
731
|
+
var a = n === l[s].id;
|
|
732
|
+
if (t === l[s].fn && a || !t && a) {
|
|
733
|
+
l.splice(s, 1);
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
else if (e)
|
|
738
|
+
o["_on" + e] = [];
|
|
739
|
+
else {
|
|
740
|
+
var _ = Object.keys(o);
|
|
741
|
+
for (s = 0; s < _.length; s++)
|
|
742
|
+
_[s].indexOf("_on") === 0 && Array.isArray(o[_[s]]) && (o[_[s]] = []);
|
|
743
|
+
}
|
|
744
|
+
return o;
|
|
745
|
+
},
|
|
746
|
+
/**
|
|
747
|
+
* Listen to a custom event and remove it once fired.
|
|
748
|
+
* @param {String} event Event name.
|
|
749
|
+
* @param {Function} fn Listener to call.
|
|
750
|
+
* @param {Number} id (optional) Only listen to events for this sound.
|
|
751
|
+
* @return {Howl}
|
|
752
|
+
*/
|
|
753
|
+
once: function(e, t, n) {
|
|
754
|
+
var o = this;
|
|
755
|
+
return o.on(e, t, n, 1), o;
|
|
756
|
+
},
|
|
757
|
+
/**
|
|
758
|
+
* Emit all events of a specific type and pass the sound id.
|
|
759
|
+
* @param {String} event Event name.
|
|
760
|
+
* @param {Number} id Sound ID.
|
|
761
|
+
* @param {Number} msg Message to go with event.
|
|
762
|
+
* @return {Howl}
|
|
763
|
+
*/
|
|
764
|
+
_emit: function(e, t, n) {
|
|
765
|
+
for (var o = this, l = o["_on" + e], s = l.length - 1; s >= 0; s--)
|
|
766
|
+
(!l[s].id || l[s].id === t || e === "load") && (setTimeout(function(a) {
|
|
767
|
+
a.call(this, t, n);
|
|
768
|
+
}.bind(o, l[s].fn), 0), l[s].once && o.off(e, l[s].fn, l[s].id));
|
|
769
|
+
return o._loadQueue(e), o;
|
|
770
|
+
},
|
|
771
|
+
/**
|
|
772
|
+
* Queue of actions initiated before the sound has loaded.
|
|
773
|
+
* These will be called in sequence, with the next only firing
|
|
774
|
+
* after the previous has finished executing (even if async like play).
|
|
775
|
+
* @return {Howl}
|
|
776
|
+
*/
|
|
777
|
+
_loadQueue: function(e) {
|
|
778
|
+
var t = this;
|
|
779
|
+
if (t._queue.length > 0) {
|
|
780
|
+
var n = t._queue[0];
|
|
781
|
+
n.event === e && (t._queue.shift(), t._loadQueue()), e || n.action();
|
|
782
|
+
}
|
|
783
|
+
return t;
|
|
784
|
+
},
|
|
785
|
+
/**
|
|
786
|
+
* Fired when playback ends at the end of the duration.
|
|
787
|
+
* @param {Sound} sound The sound object to work with.
|
|
788
|
+
* @return {Howl}
|
|
789
|
+
*/
|
|
790
|
+
_ended: function(e) {
|
|
791
|
+
var t = this, n = e._sprite;
|
|
792
|
+
if (!t._webAudio && e._node && !e._node.paused && !e._node.ended && e._node.currentTime < e._stop)
|
|
793
|
+
return setTimeout(t._ended.bind(t, e), 100), t;
|
|
794
|
+
var o = !!(e._loop || t._sprite[n][2]);
|
|
795
|
+
if (t._emit("end", e._id), !t._webAudio && o && t.stop(e._id, !0).play(e._id), t._webAudio && o) {
|
|
796
|
+
t._emit("play", e._id), e._seek = e._start || 0, e._rateSeek = 0, e._playStart = r.ctx.currentTime;
|
|
797
|
+
var l = (e._stop - e._start) * 1e3 / Math.abs(e._rate);
|
|
798
|
+
t._endTimers[e._id] = setTimeout(t._ended.bind(t, e), l);
|
|
799
|
+
}
|
|
800
|
+
return t._webAudio && !o && (e._paused = !0, e._ended = !0, e._seek = e._start || 0, e._rateSeek = 0, t._clearTimer(e._id), t._cleanBuffer(e._node), r._autoSuspend()), !t._webAudio && !o && t.stop(e._id, !0), t;
|
|
801
|
+
},
|
|
802
|
+
/**
|
|
803
|
+
* Clear the end timer for a sound playback.
|
|
804
|
+
* @param {Number} id The sound ID.
|
|
805
|
+
* @return {Howl}
|
|
806
|
+
*/
|
|
807
|
+
_clearTimer: function(e) {
|
|
808
|
+
var t = this;
|
|
809
|
+
if (t._endTimers[e]) {
|
|
810
|
+
if (typeof t._endTimers[e] != "function")
|
|
811
|
+
clearTimeout(t._endTimers[e]);
|
|
812
|
+
else {
|
|
813
|
+
var n = t._soundById(e);
|
|
814
|
+
n && n._node && n._node.removeEventListener("ended", t._endTimers[e], !1);
|
|
815
|
+
}
|
|
816
|
+
delete t._endTimers[e];
|
|
817
|
+
}
|
|
818
|
+
return t;
|
|
819
|
+
},
|
|
820
|
+
/**
|
|
821
|
+
* Return the sound identified by this ID, or return null.
|
|
822
|
+
* @param {Number} id Sound ID
|
|
823
|
+
* @return {Object} Sound object or null.
|
|
824
|
+
*/
|
|
825
|
+
_soundById: function(e) {
|
|
826
|
+
for (var t = this, n = 0; n < t._sounds.length; n++)
|
|
827
|
+
if (e === t._sounds[n]._id)
|
|
828
|
+
return t._sounds[n];
|
|
829
|
+
return null;
|
|
830
|
+
},
|
|
831
|
+
/**
|
|
832
|
+
* Return an inactive sound from the pool or create a new one.
|
|
833
|
+
* @return {Sound} Sound playback object.
|
|
834
|
+
*/
|
|
835
|
+
_inactiveSound: function() {
|
|
836
|
+
var e = this;
|
|
837
|
+
e._drain();
|
|
838
|
+
for (var t = 0; t < e._sounds.length; t++)
|
|
839
|
+
if (e._sounds[t]._ended)
|
|
840
|
+
return e._sounds[t].reset();
|
|
841
|
+
return new u(e);
|
|
842
|
+
},
|
|
843
|
+
/**
|
|
844
|
+
* Drain excess inactive sounds from the pool.
|
|
845
|
+
*/
|
|
846
|
+
_drain: function() {
|
|
847
|
+
var e = this, t = e._pool, n = 0, o = 0;
|
|
848
|
+
if (!(e._sounds.length < t)) {
|
|
849
|
+
for (o = 0; o < e._sounds.length; o++)
|
|
850
|
+
e._sounds[o]._ended && n++;
|
|
851
|
+
for (o = e._sounds.length - 1; o >= 0; o--) {
|
|
852
|
+
if (n <= t)
|
|
853
|
+
return;
|
|
854
|
+
e._sounds[o]._ended && (e._webAudio && e._sounds[o]._node && e._sounds[o]._node.disconnect(0), e._sounds.splice(o, 1), n--);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
/**
|
|
859
|
+
* Get all ID's from the sounds pool.
|
|
860
|
+
* @param {Number} id Only return one ID if one is passed.
|
|
861
|
+
* @return {Array} Array of IDs.
|
|
862
|
+
*/
|
|
863
|
+
_getSoundIds: function(e) {
|
|
864
|
+
var t = this;
|
|
865
|
+
if (typeof e > "u") {
|
|
866
|
+
for (var n = [], o = 0; o < t._sounds.length; o++)
|
|
867
|
+
n.push(t._sounds[o]._id);
|
|
868
|
+
return n;
|
|
869
|
+
} else
|
|
870
|
+
return [e];
|
|
871
|
+
},
|
|
872
|
+
/**
|
|
873
|
+
* Load the sound back into the buffer source.
|
|
874
|
+
* @param {Sound} sound The sound object to work with.
|
|
875
|
+
* @return {Howl}
|
|
876
|
+
*/
|
|
877
|
+
_refreshBuffer: function(e) {
|
|
878
|
+
var t = this;
|
|
879
|
+
return e._node.bufferSource = r.ctx.createBufferSource(), e._node.bufferSource.buffer = c[t._src], e._panner ? e._node.bufferSource.connect(e._panner) : e._node.bufferSource.connect(e._node), e._node.bufferSource.loop = e._loop, e._loop && (e._node.bufferSource.loopStart = e._start || 0, e._node.bufferSource.loopEnd = e._stop || 0), e._node.bufferSource.playbackRate.setValueAtTime(e._rate, r.ctx.currentTime), t;
|
|
880
|
+
},
|
|
881
|
+
/**
|
|
882
|
+
* Prevent memory leaks by cleaning up the buffer source after playback.
|
|
883
|
+
* @param {Object} node Sound's audio node containing the buffer source.
|
|
884
|
+
* @return {Howl}
|
|
885
|
+
*/
|
|
886
|
+
_cleanBuffer: function(e) {
|
|
887
|
+
var t = this, n = r._navigator && r._navigator.vendor.indexOf("Apple") >= 0;
|
|
888
|
+
if (!e.bufferSource)
|
|
889
|
+
return t;
|
|
890
|
+
if (r._scratchBuffer && e.bufferSource && (e.bufferSource.onended = null, e.bufferSource.disconnect(0), n))
|
|
891
|
+
try {
|
|
892
|
+
e.bufferSource.buffer = r._scratchBuffer;
|
|
893
|
+
} catch {
|
|
894
|
+
}
|
|
895
|
+
return e.bufferSource = null, t;
|
|
896
|
+
},
|
|
897
|
+
/**
|
|
898
|
+
* Set the source to a 0-second silence to stop any downloading (except in IE).
|
|
899
|
+
* @param {Object} node Audio node to clear.
|
|
900
|
+
*/
|
|
901
|
+
_clearSound: function(e) {
|
|
902
|
+
var t = /MSIE |Trident\//.test(r._navigator && r._navigator.userAgent);
|
|
903
|
+
t || (e.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
var u = function(e) {
|
|
907
|
+
this._parent = e, this.init();
|
|
908
|
+
};
|
|
909
|
+
u.prototype = {
|
|
910
|
+
/**
|
|
911
|
+
* Initialize a new Sound object.
|
|
912
|
+
* @return {Sound}
|
|
913
|
+
*/
|
|
914
|
+
init: function() {
|
|
915
|
+
var e = this, t = e._parent;
|
|
916
|
+
return e._muted = t._muted, e._loop = t._loop, e._volume = t._volume, e._rate = t._rate, e._seek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++r._counter, t._sounds.push(e), e.create(), e;
|
|
917
|
+
},
|
|
918
|
+
/**
|
|
919
|
+
* Create and setup a new sound object, whether HTML5 Audio or Web Audio.
|
|
920
|
+
* @return {Sound}
|
|
921
|
+
*/
|
|
922
|
+
create: function() {
|
|
923
|
+
var e = this, t = e._parent, n = r._muted || e._muted || e._parent._muted ? 0 : e._volume;
|
|
924
|
+
return t._webAudio ? (e._node = typeof r.ctx.createGain > "u" ? r.ctx.createGainNode() : r.ctx.createGain(), e._node.gain.setValueAtTime(n, r.ctx.currentTime), e._node.paused = !0, e._node.connect(r.masterGain)) : r.noAudio || (e._node = r._obtainHtml5Audio(), e._errorFn = e._errorListener.bind(e), e._node.addEventListener("error", e._errorFn, !1), e._loadFn = e._loadListener.bind(e), e._node.addEventListener(r._canPlayEvent, e._loadFn, !1), e._endFn = e._endListener.bind(e), e._node.addEventListener("ended", e._endFn, !1), e._node.src = t._src, e._node.preload = t._preload === !0 ? "auto" : t._preload, e._node.volume = n * r.volume(), e._node.load()), e;
|
|
925
|
+
},
|
|
926
|
+
/**
|
|
927
|
+
* Reset the parameters of this sound to the original state (for recycle).
|
|
928
|
+
* @return {Sound}
|
|
929
|
+
*/
|
|
930
|
+
reset: function() {
|
|
931
|
+
var e = this, t = e._parent;
|
|
932
|
+
return e._muted = t._muted, e._loop = t._loop, e._volume = t._volume, e._rate = t._rate, e._seek = 0, e._rateSeek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++r._counter, e;
|
|
933
|
+
},
|
|
934
|
+
/**
|
|
935
|
+
* HTML5 Audio error listener callback.
|
|
936
|
+
*/
|
|
937
|
+
_errorListener: function() {
|
|
938
|
+
var e = this;
|
|
939
|
+
e._parent._emit("loaderror", e._id, e._node.error ? e._node.error.code : 0), e._node.removeEventListener("error", e._errorFn, !1);
|
|
940
|
+
},
|
|
941
|
+
/**
|
|
942
|
+
* HTML5 Audio canplaythrough listener callback.
|
|
943
|
+
*/
|
|
944
|
+
_loadListener: function() {
|
|
945
|
+
var e = this, t = e._parent;
|
|
946
|
+
t._duration = Math.ceil(e._node.duration * 10) / 10, Object.keys(t._sprite).length === 0 && (t._sprite = { __default: [0, t._duration * 1e3] }), t._state !== "loaded" && (t._state = "loaded", t._emit("load"), t._loadQueue()), e._node.removeEventListener(r._canPlayEvent, e._loadFn, !1);
|
|
947
|
+
},
|
|
948
|
+
/**
|
|
949
|
+
* HTML5 Audio ended listener callback.
|
|
950
|
+
*/
|
|
951
|
+
_endListener: function() {
|
|
952
|
+
var e = this, t = e._parent;
|
|
953
|
+
t._duration === 1 / 0 && (t._duration = Math.ceil(e._node.duration * 10) / 10, t._sprite.__default[1] === 1 / 0 && (t._sprite.__default[1] = t._duration * 1e3), t._ended(e)), e._node.removeEventListener("ended", e._endFn, !1);
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
var c = {}, d = function(e) {
|
|
957
|
+
var t = e._src;
|
|
958
|
+
if (c[t]) {
|
|
959
|
+
e._duration = c[t].duration, f(e);
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
if (/^data:[^;]+;base64,/.test(t)) {
|
|
963
|
+
for (var n = atob(t.split(",")[1]), o = new Uint8Array(n.length), l = 0; l < n.length; ++l)
|
|
964
|
+
o[l] = n.charCodeAt(l);
|
|
965
|
+
p(o.buffer, e);
|
|
966
|
+
} else {
|
|
967
|
+
var s = new XMLHttpRequest();
|
|
968
|
+
s.open(e._xhr.method, t, !0), s.withCredentials = e._xhr.withCredentials, s.responseType = "arraybuffer", e._xhr.headers && Object.keys(e._xhr.headers).forEach(function(a) {
|
|
969
|
+
s.setRequestHeader(a, e._xhr.headers[a]);
|
|
970
|
+
}), s.onload = function() {
|
|
971
|
+
var a = (s.status + "")[0];
|
|
972
|
+
if (a !== "0" && a !== "2" && a !== "3") {
|
|
973
|
+
e._emit("loaderror", null, "Failed loading audio file with status: " + s.status + ".");
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
p(s.response, e);
|
|
977
|
+
}, s.onerror = function() {
|
|
978
|
+
e._webAudio && (e._html5 = !0, e._webAudio = !1, e._sounds = [], delete c[t], e.load());
|
|
979
|
+
}, v(s);
|
|
980
|
+
}
|
|
981
|
+
}, v = function(e) {
|
|
982
|
+
try {
|
|
983
|
+
e.send();
|
|
984
|
+
} catch {
|
|
985
|
+
e.onerror();
|
|
986
|
+
}
|
|
987
|
+
}, p = function(e, t) {
|
|
988
|
+
var n = function() {
|
|
989
|
+
t._emit("loaderror", null, "Decoding audio data failed.");
|
|
990
|
+
}, o = function(l) {
|
|
991
|
+
l && t._sounds.length > 0 ? (c[t._src] = l, f(t, l)) : n();
|
|
992
|
+
};
|
|
993
|
+
typeof Promise < "u" && r.ctx.decodeAudioData.length === 1 ? r.ctx.decodeAudioData(e).then(o).catch(n) : r.ctx.decodeAudioData(e, o, n);
|
|
994
|
+
}, f = function(e, t) {
|
|
995
|
+
t && !e._duration && (e._duration = t.duration), Object.keys(e._sprite).length === 0 && (e._sprite = { __default: [0, e._duration * 1e3] }), e._state !== "loaded" && (e._state = "loaded", e._emit("load"), e._loadQueue());
|
|
996
|
+
}, A = function() {
|
|
997
|
+
if (r.usingWebAudio) {
|
|
998
|
+
try {
|
|
999
|
+
typeof AudioContext < "u" ? r.ctx = new AudioContext() : typeof webkitAudioContext < "u" ? r.ctx = new webkitAudioContext() : r.usingWebAudio = !1;
|
|
1000
|
+
} catch {
|
|
1001
|
+
r.usingWebAudio = !1;
|
|
1002
|
+
}
|
|
1003
|
+
r.ctx || (r.usingWebAudio = !1);
|
|
1004
|
+
var e = /iP(hone|od|ad)/.test(r._navigator && r._navigator.platform), t = r._navigator && r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), n = t ? parseInt(t[1], 10) : null;
|
|
1005
|
+
if (e && n && n < 9) {
|
|
1006
|
+
var o = /safari/.test(r._navigator && r._navigator.userAgent.toLowerCase());
|
|
1007
|
+
r._navigator && !o && (r.usingWebAudio = !1);
|
|
1008
|
+
}
|
|
1009
|
+
r.usingWebAudio && (r.masterGain = typeof r.ctx.createGain > "u" ? r.ctx.createGainNode() : r.ctx.createGain(), r.masterGain.gain.setValueAtTime(r._muted ? 0 : r._volume, r.ctx.currentTime), r.masterGain.connect(r.ctx.destination)), r._setup();
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
O.Howler = r, O.Howl = i, typeof H < "u" ? (H.HowlerGlobal = g, H.Howler = r, H.Howl = i, H.Sound = u) : typeof window < "u" && (window.HowlerGlobal = g, window.Howler = r, window.Howl = i, window.Sound = u);
|
|
1013
|
+
})();
|
|
1014
|
+
/*!
|
|
1015
|
+
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
|
|
1016
|
+
*
|
|
1017
|
+
* howler.js v2.2.4
|
|
1018
|
+
* howlerjs.com
|
|
1019
|
+
*
|
|
1020
|
+
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
1021
|
+
* goldfirestudios.com
|
|
1022
|
+
*
|
|
1023
|
+
* MIT License
|
|
1024
|
+
*/
|
|
1025
|
+
(function() {
|
|
1026
|
+
HowlerGlobal.prototype._pos = [0, 0, 0], HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0], HowlerGlobal.prototype.stereo = function(r) {
|
|
1027
|
+
var i = this;
|
|
1028
|
+
if (!i.ctx || !i.ctx.listener)
|
|
1029
|
+
return i;
|
|
1030
|
+
for (var u = i._howls.length - 1; u >= 0; u--)
|
|
1031
|
+
i._howls[u].stereo(r);
|
|
1032
|
+
return i;
|
|
1033
|
+
}, HowlerGlobal.prototype.pos = function(r, i, u) {
|
|
1034
|
+
var c = this;
|
|
1035
|
+
if (!c.ctx || !c.ctx.listener)
|
|
1036
|
+
return c;
|
|
1037
|
+
if (i = typeof i != "number" ? c._pos[1] : i, u = typeof u != "number" ? c._pos[2] : u, typeof r == "number")
|
|
1038
|
+
c._pos = [r, i, u], typeof c.ctx.listener.positionX < "u" ? (c.ctx.listener.positionX.setTargetAtTime(c._pos[0], Howler.ctx.currentTime, 0.1), c.ctx.listener.positionY.setTargetAtTime(c._pos[1], Howler.ctx.currentTime, 0.1), c.ctx.listener.positionZ.setTargetAtTime(c._pos[2], Howler.ctx.currentTime, 0.1)) : c.ctx.listener.setPosition(c._pos[0], c._pos[1], c._pos[2]);
|
|
1039
|
+
else
|
|
1040
|
+
return c._pos;
|
|
1041
|
+
return c;
|
|
1042
|
+
}, HowlerGlobal.prototype.orientation = function(r, i, u, c, d, v) {
|
|
1043
|
+
var p = this;
|
|
1044
|
+
if (!p.ctx || !p.ctx.listener)
|
|
1045
|
+
return p;
|
|
1046
|
+
var f = p._orientation;
|
|
1047
|
+
if (i = typeof i != "number" ? f[1] : i, u = typeof u != "number" ? f[2] : u, c = typeof c != "number" ? f[3] : c, d = typeof d != "number" ? f[4] : d, v = typeof v != "number" ? f[5] : v, typeof r == "number")
|
|
1048
|
+
p._orientation = [r, i, u, c, d, v], typeof p.ctx.listener.forwardX < "u" ? (p.ctx.listener.forwardX.setTargetAtTime(r, Howler.ctx.currentTime, 0.1), p.ctx.listener.forwardY.setTargetAtTime(i, Howler.ctx.currentTime, 0.1), p.ctx.listener.forwardZ.setTargetAtTime(u, Howler.ctx.currentTime, 0.1), p.ctx.listener.upX.setTargetAtTime(c, Howler.ctx.currentTime, 0.1), p.ctx.listener.upY.setTargetAtTime(d, Howler.ctx.currentTime, 0.1), p.ctx.listener.upZ.setTargetAtTime(v, Howler.ctx.currentTime, 0.1)) : p.ctx.listener.setOrientation(r, i, u, c, d, v);
|
|
1049
|
+
else
|
|
1050
|
+
return f;
|
|
1051
|
+
return p;
|
|
1052
|
+
}, Howl.prototype.init = /* @__PURE__ */ (function(r) {
|
|
1053
|
+
return function(i) {
|
|
1054
|
+
var u = this;
|
|
1055
|
+
return u._orientation = i.orientation || [1, 0, 0], u._stereo = i.stereo || null, u._pos = i.pos || null, u._pannerAttr = {
|
|
1056
|
+
coneInnerAngle: typeof i.coneInnerAngle < "u" ? i.coneInnerAngle : 360,
|
|
1057
|
+
coneOuterAngle: typeof i.coneOuterAngle < "u" ? i.coneOuterAngle : 360,
|
|
1058
|
+
coneOuterGain: typeof i.coneOuterGain < "u" ? i.coneOuterGain : 0,
|
|
1059
|
+
distanceModel: typeof i.distanceModel < "u" ? i.distanceModel : "inverse",
|
|
1060
|
+
maxDistance: typeof i.maxDistance < "u" ? i.maxDistance : 1e4,
|
|
1061
|
+
panningModel: typeof i.panningModel < "u" ? i.panningModel : "HRTF",
|
|
1062
|
+
refDistance: typeof i.refDistance < "u" ? i.refDistance : 1,
|
|
1063
|
+
rolloffFactor: typeof i.rolloffFactor < "u" ? i.rolloffFactor : 1
|
|
1064
|
+
}, u._onstereo = i.onstereo ? [{ fn: i.onstereo }] : [], u._onpos = i.onpos ? [{ fn: i.onpos }] : [], u._onorientation = i.onorientation ? [{ fn: i.onorientation }] : [], r.call(this, i);
|
|
1065
|
+
};
|
|
1066
|
+
})(Howl.prototype.init), Howl.prototype.stereo = function(r, i) {
|
|
1067
|
+
var u = this;
|
|
1068
|
+
if (!u._webAudio)
|
|
1069
|
+
return u;
|
|
1070
|
+
if (u._state !== "loaded")
|
|
1071
|
+
return u._queue.push({
|
|
1072
|
+
event: "stereo",
|
|
1073
|
+
action: function() {
|
|
1074
|
+
u.stereo(r, i);
|
|
1075
|
+
}
|
|
1076
|
+
}), u;
|
|
1077
|
+
var c = typeof Howler.ctx.createStereoPanner > "u" ? "spatial" : "stereo";
|
|
1078
|
+
if (typeof i > "u")
|
|
1079
|
+
if (typeof r == "number")
|
|
1080
|
+
u._stereo = r, u._pos = [r, 0, 0];
|
|
1081
|
+
else
|
|
1082
|
+
return u._stereo;
|
|
1083
|
+
for (var d = u._getSoundIds(i), v = 0; v < d.length; v++) {
|
|
1084
|
+
var p = u._soundById(d[v]);
|
|
1085
|
+
if (p)
|
|
1086
|
+
if (typeof r == "number")
|
|
1087
|
+
p._stereo = r, p._pos = [r, 0, 0], p._node && (p._pannerAttr.panningModel = "equalpower", (!p._panner || !p._panner.pan) && g(p, c), c === "spatial" ? typeof p._panner.positionX < "u" ? (p._panner.positionX.setValueAtTime(r, Howler.ctx.currentTime), p._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime), p._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : p._panner.setPosition(r, 0, 0) : p._panner.pan.setValueAtTime(r, Howler.ctx.currentTime)), u._emit("stereo", p._id);
|
|
1088
|
+
else
|
|
1089
|
+
return p._stereo;
|
|
1090
|
+
}
|
|
1091
|
+
return u;
|
|
1092
|
+
}, Howl.prototype.pos = function(r, i, u, c) {
|
|
1093
|
+
var d = this;
|
|
1094
|
+
if (!d._webAudio)
|
|
1095
|
+
return d;
|
|
1096
|
+
if (d._state !== "loaded")
|
|
1097
|
+
return d._queue.push({
|
|
1098
|
+
event: "pos",
|
|
1099
|
+
action: function() {
|
|
1100
|
+
d.pos(r, i, u, c);
|
|
1101
|
+
}
|
|
1102
|
+
}), d;
|
|
1103
|
+
if (i = typeof i != "number" ? 0 : i, u = typeof u != "number" ? -0.5 : u, typeof c > "u")
|
|
1104
|
+
if (typeof r == "number")
|
|
1105
|
+
d._pos = [r, i, u];
|
|
1106
|
+
else
|
|
1107
|
+
return d._pos;
|
|
1108
|
+
for (var v = d._getSoundIds(c), p = 0; p < v.length; p++) {
|
|
1109
|
+
var f = d._soundById(v[p]);
|
|
1110
|
+
if (f)
|
|
1111
|
+
if (typeof r == "number")
|
|
1112
|
+
f._pos = [r, i, u], f._node && ((!f._panner || f._panner.pan) && g(f, "spatial"), typeof f._panner.positionX < "u" ? (f._panner.positionX.setValueAtTime(r, Howler.ctx.currentTime), f._panner.positionY.setValueAtTime(i, Howler.ctx.currentTime), f._panner.positionZ.setValueAtTime(u, Howler.ctx.currentTime)) : f._panner.setPosition(r, i, u)), d._emit("pos", f._id);
|
|
1113
|
+
else
|
|
1114
|
+
return f._pos;
|
|
1115
|
+
}
|
|
1116
|
+
return d;
|
|
1117
|
+
}, Howl.prototype.orientation = function(r, i, u, c) {
|
|
1118
|
+
var d = this;
|
|
1119
|
+
if (!d._webAudio)
|
|
1120
|
+
return d;
|
|
1121
|
+
if (d._state !== "loaded")
|
|
1122
|
+
return d._queue.push({
|
|
1123
|
+
event: "orientation",
|
|
1124
|
+
action: function() {
|
|
1125
|
+
d.orientation(r, i, u, c);
|
|
1126
|
+
}
|
|
1127
|
+
}), d;
|
|
1128
|
+
if (i = typeof i != "number" ? d._orientation[1] : i, u = typeof u != "number" ? d._orientation[2] : u, typeof c > "u")
|
|
1129
|
+
if (typeof r == "number")
|
|
1130
|
+
d._orientation = [r, i, u];
|
|
1131
|
+
else
|
|
1132
|
+
return d._orientation;
|
|
1133
|
+
for (var v = d._getSoundIds(c), p = 0; p < v.length; p++) {
|
|
1134
|
+
var f = d._soundById(v[p]);
|
|
1135
|
+
if (f)
|
|
1136
|
+
if (typeof r == "number")
|
|
1137
|
+
f._orientation = [r, i, u], f._node && (f._panner || (f._pos || (f._pos = d._pos || [0, 0, -0.5]), g(f, "spatial")), typeof f._panner.orientationX < "u" ? (f._panner.orientationX.setValueAtTime(r, Howler.ctx.currentTime), f._panner.orientationY.setValueAtTime(i, Howler.ctx.currentTime), f._panner.orientationZ.setValueAtTime(u, Howler.ctx.currentTime)) : f._panner.setOrientation(r, i, u)), d._emit("orientation", f._id);
|
|
1138
|
+
else
|
|
1139
|
+
return f._orientation;
|
|
1140
|
+
}
|
|
1141
|
+
return d;
|
|
1142
|
+
}, Howl.prototype.pannerAttr = function() {
|
|
1143
|
+
var r = this, i = arguments, u, c, d;
|
|
1144
|
+
if (!r._webAudio)
|
|
1145
|
+
return r;
|
|
1146
|
+
if (i.length === 0)
|
|
1147
|
+
return r._pannerAttr;
|
|
1148
|
+
if (i.length === 1)
|
|
1149
|
+
if (typeof i[0] == "object")
|
|
1150
|
+
u = i[0], typeof c > "u" && (u.pannerAttr || (u.pannerAttr = {
|
|
1151
|
+
coneInnerAngle: u.coneInnerAngle,
|
|
1152
|
+
coneOuterAngle: u.coneOuterAngle,
|
|
1153
|
+
coneOuterGain: u.coneOuterGain,
|
|
1154
|
+
distanceModel: u.distanceModel,
|
|
1155
|
+
maxDistance: u.maxDistance,
|
|
1156
|
+
refDistance: u.refDistance,
|
|
1157
|
+
rolloffFactor: u.rolloffFactor,
|
|
1158
|
+
panningModel: u.panningModel
|
|
1159
|
+
}), r._pannerAttr = {
|
|
1160
|
+
coneInnerAngle: typeof u.pannerAttr.coneInnerAngle < "u" ? u.pannerAttr.coneInnerAngle : r._coneInnerAngle,
|
|
1161
|
+
coneOuterAngle: typeof u.pannerAttr.coneOuterAngle < "u" ? u.pannerAttr.coneOuterAngle : r._coneOuterAngle,
|
|
1162
|
+
coneOuterGain: typeof u.pannerAttr.coneOuterGain < "u" ? u.pannerAttr.coneOuterGain : r._coneOuterGain,
|
|
1163
|
+
distanceModel: typeof u.pannerAttr.distanceModel < "u" ? u.pannerAttr.distanceModel : r._distanceModel,
|
|
1164
|
+
maxDistance: typeof u.pannerAttr.maxDistance < "u" ? u.pannerAttr.maxDistance : r._maxDistance,
|
|
1165
|
+
refDistance: typeof u.pannerAttr.refDistance < "u" ? u.pannerAttr.refDistance : r._refDistance,
|
|
1166
|
+
rolloffFactor: typeof u.pannerAttr.rolloffFactor < "u" ? u.pannerAttr.rolloffFactor : r._rolloffFactor,
|
|
1167
|
+
panningModel: typeof u.pannerAttr.panningModel < "u" ? u.pannerAttr.panningModel : r._panningModel
|
|
1168
|
+
});
|
|
1169
|
+
else
|
|
1170
|
+
return d = r._soundById(parseInt(i[0], 10)), d ? d._pannerAttr : r._pannerAttr;
|
|
1171
|
+
else i.length === 2 && (u = i[0], c = parseInt(i[1], 10));
|
|
1172
|
+
for (var v = r._getSoundIds(c), p = 0; p < v.length; p++)
|
|
1173
|
+
if (d = r._soundById(v[p]), d) {
|
|
1174
|
+
var f = d._pannerAttr;
|
|
1175
|
+
f = {
|
|
1176
|
+
coneInnerAngle: typeof u.coneInnerAngle < "u" ? u.coneInnerAngle : f.coneInnerAngle,
|
|
1177
|
+
coneOuterAngle: typeof u.coneOuterAngle < "u" ? u.coneOuterAngle : f.coneOuterAngle,
|
|
1178
|
+
coneOuterGain: typeof u.coneOuterGain < "u" ? u.coneOuterGain : f.coneOuterGain,
|
|
1179
|
+
distanceModel: typeof u.distanceModel < "u" ? u.distanceModel : f.distanceModel,
|
|
1180
|
+
maxDistance: typeof u.maxDistance < "u" ? u.maxDistance : f.maxDistance,
|
|
1181
|
+
refDistance: typeof u.refDistance < "u" ? u.refDistance : f.refDistance,
|
|
1182
|
+
rolloffFactor: typeof u.rolloffFactor < "u" ? u.rolloffFactor : f.rolloffFactor,
|
|
1183
|
+
panningModel: typeof u.panningModel < "u" ? u.panningModel : f.panningModel
|
|
1184
|
+
};
|
|
1185
|
+
var A = d._panner;
|
|
1186
|
+
A || (d._pos || (d._pos = r._pos || [0, 0, -0.5]), g(d, "spatial"), A = d._panner), A.coneInnerAngle = f.coneInnerAngle, A.coneOuterAngle = f.coneOuterAngle, A.coneOuterGain = f.coneOuterGain, A.distanceModel = f.distanceModel, A.maxDistance = f.maxDistance, A.refDistance = f.refDistance, A.rolloffFactor = f.rolloffFactor, A.panningModel = f.panningModel;
|
|
1187
|
+
}
|
|
1188
|
+
return r;
|
|
1189
|
+
}, Sound.prototype.init = /* @__PURE__ */ (function(r) {
|
|
1190
|
+
return function() {
|
|
1191
|
+
var i = this, u = i._parent;
|
|
1192
|
+
i._orientation = u._orientation, i._stereo = u._stereo, i._pos = u._pos, i._pannerAttr = u._pannerAttr, r.call(this), i._stereo ? u.stereo(i._stereo) : i._pos && u.pos(i._pos[0], i._pos[1], i._pos[2], i._id);
|
|
1193
|
+
};
|
|
1194
|
+
})(Sound.prototype.init), Sound.prototype.reset = /* @__PURE__ */ (function(r) {
|
|
1195
|
+
return function() {
|
|
1196
|
+
var i = this, u = i._parent;
|
|
1197
|
+
return i._orientation = u._orientation, i._stereo = u._stereo, i._pos = u._pos, i._pannerAttr = u._pannerAttr, i._stereo ? u.stereo(i._stereo) : i._pos ? u.pos(i._pos[0], i._pos[1], i._pos[2], i._id) : i._panner && (i._panner.disconnect(0), i._panner = void 0, u._refreshBuffer(i)), r.call(this);
|
|
1198
|
+
};
|
|
1199
|
+
})(Sound.prototype.reset);
|
|
1200
|
+
var g = function(r, i) {
|
|
1201
|
+
i = i || "spatial", i === "spatial" ? (r._panner = Howler.ctx.createPanner(), r._panner.coneInnerAngle = r._pannerAttr.coneInnerAngle, r._panner.coneOuterAngle = r._pannerAttr.coneOuterAngle, r._panner.coneOuterGain = r._pannerAttr.coneOuterGain, r._panner.distanceModel = r._pannerAttr.distanceModel, r._panner.maxDistance = r._pannerAttr.maxDistance, r._panner.refDistance = r._pannerAttr.refDistance, r._panner.rolloffFactor = r._pannerAttr.rolloffFactor, r._panner.panningModel = r._pannerAttr.panningModel, typeof r._panner.positionX < "u" ? (r._panner.positionX.setValueAtTime(r._pos[0], Howler.ctx.currentTime), r._panner.positionY.setValueAtTime(r._pos[1], Howler.ctx.currentTime), r._panner.positionZ.setValueAtTime(r._pos[2], Howler.ctx.currentTime)) : r._panner.setPosition(r._pos[0], r._pos[1], r._pos[2]), typeof r._panner.orientationX < "u" ? (r._panner.orientationX.setValueAtTime(r._orientation[0], Howler.ctx.currentTime), r._panner.orientationY.setValueAtTime(r._orientation[1], Howler.ctx.currentTime), r._panner.orientationZ.setValueAtTime(r._orientation[2], Howler.ctx.currentTime)) : r._panner.setOrientation(r._orientation[0], r._orientation[1], r._orientation[2])) : (r._panner = Howler.ctx.createStereoPanner(), r._panner.pan.setValueAtTime(r._stereo, Howler.ctx.currentTime)), r._panner.connect(r._node), r._paused || r._parent.pause(r._id, !0).play(r._id, !0);
|
|
1202
|
+
};
|
|
1203
|
+
})();
|
|
1204
|
+
})(F)), F;
|
|
1205
|
+
}
|
|
1206
|
+
var j = J();
|
|
1207
|
+
const U = {
|
|
1208
|
+
src: { type: String, required: !0 }
|
|
1209
|
+
}, z = ["max"], ee = /* @__PURE__ */ W({
|
|
1210
|
+
name: `${X}-basic-audio`,
|
|
1211
|
+
__name: "BasicAudio",
|
|
1212
|
+
props: U,
|
|
1213
|
+
setup(O) {
|
|
1214
|
+
const g = O, r = $("audio"), i = S(null), u = S(!1), c = S(0), d = S(0), v = S(0.5);
|
|
1215
|
+
let p;
|
|
1216
|
+
const f = () => {
|
|
1217
|
+
i.value = new j.Howl({
|
|
1218
|
+
src: [g.src],
|
|
1219
|
+
volume: v.value,
|
|
1220
|
+
html5: !0,
|
|
1221
|
+
onload() {
|
|
1222
|
+
d.value = i.value?.duration() ?? 0;
|
|
1223
|
+
},
|
|
1224
|
+
onend() {
|
|
1225
|
+
u.value = !1, p && clearInterval(p);
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
}, A = () => {
|
|
1229
|
+
i.value || f(), u.value && i.value ? (i.value.pause(), u.value = !1, p && clearInterval(p)) : i.value && (i.value.play(), u.value = !0, p = window.setInterval(() => {
|
|
1230
|
+
c.value = i.value?.seek();
|
|
1231
|
+
}, 500));
|
|
1232
|
+
}, e = (s) => {
|
|
1233
|
+
i.value && i.value.seek(s);
|
|
1234
|
+
}, t = (s) => {
|
|
1235
|
+
v.value = s, i.value && i.value.volume(s);
|
|
1236
|
+
}, n = (s) => {
|
|
1237
|
+
const a = s.target, _ = Number(a.value);
|
|
1238
|
+
c.value = _, e(_);
|
|
1239
|
+
}, o = (s) => {
|
|
1240
|
+
const a = s.target, _ = Number(a.value);
|
|
1241
|
+
t(_);
|
|
1242
|
+
}, l = (s) => {
|
|
1243
|
+
const a = Math.floor(s / 60) || 0, _ = Math.floor(s % 60) || 0;
|
|
1244
|
+
return `${a < 10 ? "0" : ""}${a}:${_ < 10 ? "0" : ""}${_}`;
|
|
1245
|
+
};
|
|
1246
|
+
return Q(() => {
|
|
1247
|
+
f();
|
|
1248
|
+
}), Y(() => {
|
|
1249
|
+
i.value && i.value.unload(), p && clearInterval(p);
|
|
1250
|
+
}), (s, a) => (K(), Z("div", {
|
|
1251
|
+
class: k(I(r).b("wrap"))
|
|
1252
|
+
}, [
|
|
1253
|
+
b("div", {
|
|
1254
|
+
class: k(I(r).b("tool"))
|
|
1255
|
+
}, [
|
|
1256
|
+
b("div", {
|
|
1257
|
+
onClick: A,
|
|
1258
|
+
class: k(I(r).b("play"))
|
|
1259
|
+
}, P(u.value ? "⏸ 暂停" : "▶ 播放"), 3),
|
|
1260
|
+
b("div", null, P(l(c.value)) + " / " + P(l(d.value)), 1)
|
|
1261
|
+
], 2),
|
|
1262
|
+
E(b("input", {
|
|
1263
|
+
type: "range",
|
|
1264
|
+
"onUpdate:modelValue": a[0] || (a[0] = (_) => c.value = _),
|
|
1265
|
+
min: 0,
|
|
1266
|
+
max: d.value,
|
|
1267
|
+
step: "0.1",
|
|
1268
|
+
onChange: n
|
|
1269
|
+
}, null, 40, z), [
|
|
1270
|
+
[V, c.value]
|
|
1271
|
+
]),
|
|
1272
|
+
b("div", {
|
|
1273
|
+
class: k(I(r).b("sound"))
|
|
1274
|
+
}, [
|
|
1275
|
+
b("div", {
|
|
1276
|
+
class: k(I(r).be("sound", "text"))
|
|
1277
|
+
}, "音量: " + P(Math.round(v.value * 100)) + "%", 3),
|
|
1278
|
+
E(b("input", {
|
|
1279
|
+
type: "range",
|
|
1280
|
+
"onUpdate:modelValue": a[1] || (a[1] = (_) => v.value = _),
|
|
1281
|
+
min: 0,
|
|
1282
|
+
max: 1,
|
|
1283
|
+
step: "0.01",
|
|
1284
|
+
onChange: o
|
|
1285
|
+
}, null, 544), [
|
|
1286
|
+
[V, v.value]
|
|
1287
|
+
])
|
|
1288
|
+
], 2)
|
|
1289
|
+
], 2));
|
|
1290
|
+
}
|
|
1291
|
+
}), oe = N(ee);
|
|
1292
|
+
export {
|
|
1293
|
+
oe as CxBasicAudio,
|
|
1294
|
+
oe as default
|
|
1295
|
+
};
|