@bvdmitri/gyroview 0.0.0-stage → 0.9.0-cutaway.2

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.
Files changed (302) hide show
  1. package/CHANGELOG.md +402 -0
  2. package/LICENSE +21 -0
  3. package/README.md +313 -2
  4. package/dist/define.d.ts +3 -0
  5. package/dist/define.js +4 -0
  6. package/dist/index.d.ts +1204 -0
  7. package/dist/index.js +12 -0
  8. package/dist/packages/adapters/blob/src/BlobRandomAccessSource.js +36 -0
  9. package/dist/packages/adapters/fetch/src/HttpByteStream.js +173 -0
  10. package/dist/packages/adapters/fetch/src/HttpRangeSource.js +37 -0
  11. package/dist/packages/adapters/fetch/src/HttpResource.js +227 -0
  12. package/dist/packages/adapters/fetch/src/HttpResourceLocator.js +35 -0
  13. package/dist/packages/adapters/fetch/src/contentRange.js +15 -0
  14. package/dist/packages/adapters/fetch/src/httpRequest.js +136 -0
  15. package/dist/packages/adapters/fetch/src/passingFailures.js +23 -0
  16. package/dist/packages/adapters/fetch/src/rangeFailures.js +16 -0
  17. package/dist/packages/adapters/fetch/src/recordingVersion.js +37 -0
  18. package/dist/packages/adapters/mediabunny/src/MediabunnyAudioPackager.js +162 -0
  19. package/dist/packages/adapters/mediabunny/src/MediabunnyCodecReader.js +93 -0
  20. package/dist/packages/adapters/mediabunny/src/SegmentChannel.js +135 -0
  21. package/dist/packages/adapters/mediabunny/src/bufferSources.js +12 -0
  22. package/dist/packages/adapters/mediabunny/src/decoderConfigurations.js +43 -0
  23. package/dist/packages/adapters/mediabunny/src/trackColour.js +20 -0
  24. package/dist/packages/adapters/mse-audio/src/MediaSourceAudioClock.js +138 -0
  25. package/dist/packages/adapters/mse-audio/src/SourceBufferFeeder.js +263 -0
  26. package/dist/packages/adapters/mse-audio/src/events.js +26 -0
  27. package/dist/packages/adapters/mse-audio/src/mediaSourceSupport.js +81 -0
  28. package/dist/packages/adapters/three/src/ThreeFrameRenderer.js +215 -0
  29. package/dist/packages/adapters/three/src/compileAndProve.js +14 -0
  30. package/dist/packages/adapters/three/src/conversionUniforms.js +60 -0
  31. package/dist/packages/adapters/three/src/drawSchedules.js +13 -0
  32. package/dist/packages/adapters/three/src/fullscreenPass.js +52 -0
  33. package/dist/packages/adapters/three/src/glslLiterals.js +10 -0
  34. package/dist/packages/adapters/three/src/lensTextures.js +34 -0
  35. package/dist/packages/adapters/three/src/matrixCorrections.js +34 -0
  36. package/dist/packages/adapters/three/src/pictureMaterials.js +44 -0
  37. package/dist/packages/adapters/three/src/renderInto.js +15 -0
  38. package/dist/packages/adapters/three/src/rendererParts.js +108 -0
  39. package/dist/packages/adapters/three/src/rendererUniforms.js +176 -0
  40. package/dist/packages/adapters/three/src/samplingStrategies.js +26 -0
  41. package/dist/packages/adapters/three/src/scissorBox.js +20 -0
  42. package/dist/packages/adapters/three/src/seamMeter/SeamMeterPass.js +85 -0
  43. package/dist/packages/adapters/three/src/seamMeter/rowMeans.js +42 -0
  44. package/dist/packages/adapters/three/src/shaderPrograms.js +68 -0
  45. package/dist/packages/adapters/three/src/shaders/analysis.frag.js +4 -0
  46. package/dist/packages/adapters/three/src/shaders/displayConversion.js +4 -0
  47. package/dist/packages/adapters/three/src/shaders/equirectangularRays.js +4 -0
  48. package/dist/packages/adapters/three/src/shaders/fixedJoin.js +4 -0
  49. package/dist/packages/adapters/three/src/shaders/fullscreen.vert.js +4 -0
  50. package/dist/packages/adapters/three/src/shaders/header.js +4 -0
  51. package/dist/packages/adapters/three/src/shaders/lensModels.js +4 -0
  52. package/dist/packages/adapters/three/src/shaders/lensSampling.js +4 -0
  53. package/dist/packages/adapters/three/src/shaders/lensTextures.js +4 -0
  54. package/dist/packages/adapters/three/src/shaders/rawLenses.frag.js +4 -0
  55. package/dist/packages/adapters/three/src/shaders/rectilinearRays.js +4 -0
  56. package/dist/packages/adapters/three/src/shaders/screenAreas.js +4 -0
  57. package/dist/packages/adapters/three/src/shaders/stitch.frag.js +4 -0
  58. package/dist/packages/adapters/three/src/threeMatrix.js +10 -0
  59. package/dist/packages/adapters/three/src/webglRenderer.js +37 -0
  60. package/dist/packages/adapters/webcodecs/src/WebCodecsVideoDecoderPort.js +152 -0
  61. package/dist/packages/adapters/webcodecs/src/colorSpaceOf.js +32 -0
  62. package/dist/packages/core/src/application/download/BlockStore.js +97 -0
  63. package/dist/packages/core/src/application/download/DownloadedAudioSamples.js +50 -0
  64. package/dist/packages/core/src/application/download/DownloadedVideoTrack.js +122 -0
  65. package/dist/packages/core/src/application/download/FileDownload.js +208 -0
  66. package/dist/packages/core/src/application/download/RecordingBuffer.js +22 -0
  67. package/dist/packages/core/src/application/download/SampleCursor.js +89 -0
  68. package/dist/packages/core/src/application/download/SourceByteStream.js +46 -0
  69. package/dist/packages/core/src/application/download/Transfers.js +82 -0
  70. package/dist/packages/core/src/application/download/startFileDownload.js +37 -0
  71. package/dist/packages/core/src/application/gainMatching/GainMatching.js +76 -0
  72. package/dist/packages/core/src/application/gainMatching/GainMatchingFrameSink.js +80 -0
  73. package/dist/packages/core/src/application/gainMatching/referenceLensOf.js +18 -0
  74. package/dist/packages/core/src/application/playback/Buffering.js +54 -0
  75. package/dist/packages/core/src/application/playback/ClockStart.js +55 -0
  76. package/dist/packages/core/src/application/playback/ClockWatch.js +76 -0
  77. package/dist/packages/core/src/application/playback/DecodePipeline.js +234 -0
  78. package/dist/packages/core/src/application/playback/DecodeRun.js +108 -0
  79. package/dist/packages/core/src/application/playback/FramePairQueue.js +93 -0
  80. package/dist/packages/core/src/application/playback/FramePairer.js +77 -0
  81. package/dist/packages/core/src/application/playback/PictureOnScreen.js +56 -0
  82. package/dist/packages/core/src/application/playback/PlaybackSession.js +410 -0
  83. package/dist/packages/core/src/application/playback/SeekOrder.js +35 -0
  84. package/dist/packages/core/src/application/playback/SessionLifecycle.js +42 -0
  85. package/dist/packages/core/src/application/playback/StartGate.js +69 -0
  86. package/dist/packages/core/src/application/playback/TimeUpdates.js +31 -0
  87. package/dist/packages/core/src/application/playback/WallClock.js +46 -0
  88. package/dist/packages/core/src/application/playback/keyframeTimeAt.js +15 -0
  89. package/dist/packages/core/src/application/playback/probeDecoding.js +182 -0
  90. package/dist/packages/core/src/application/recording/frameTimesOf.js +21 -0
  91. package/dist/packages/core/src/application/recording/inspectLayout.js +21 -0
  92. package/dist/packages/core/src/application/recording/inspectRecording.js +125 -0
  93. package/dist/packages/core/src/application/recording/locateOtherLensFile.js +18 -0
  94. package/dist/packages/core/src/application/recording/motionOf.js +43 -0
  95. package/dist/packages/core/src/application/recording/readRecording.js +31 -0
  96. package/dist/packages/core/src/application/recording/readRecordingFiles.js +130 -0
  97. package/dist/packages/core/src/application/recording/readSampleTable.js +27 -0
  98. package/dist/packages/core/src/application/recording/timeRecording.js +57 -0
  99. package/dist/packages/core/src/application/stabilization/StabilizingFrameSink.js +33 -0
  100. package/dist/packages/core/src/domain/colour/DisplayConversion.js +137 -0
  101. package/dist/packages/core/src/domain/colour/TrackColour.js +38 -0
  102. package/dist/packages/core/src/domain/colour/gainMatch.js +64 -0
  103. package/dist/packages/core/src/domain/colour/matrixCorrection.js +76 -0
  104. package/dist/packages/core/src/domain/container/KeyframeRule.js +7 -0
  105. package/dist/packages/core/src/domain/container/SampleTable.js +29 -0
  106. package/dist/packages/core/src/domain/container/TrackSampleTable.js +96 -0
  107. package/dist/packages/core/src/domain/container/presentationOrder.js +10 -0
  108. package/dist/packages/core/src/domain/download/DownloadPolicy.js +84 -0
  109. package/dist/packages/core/src/domain/download/isReadyToResume.js +27 -0
  110. package/dist/packages/core/src/domain/download/planDownloads.js +175 -0
  111. package/dist/packages/core/src/domain/download/trackNeeds.js +32 -0
  112. package/dist/packages/core/src/domain/format/boxes/BoxLayout.js +7 -0
  113. package/dist/packages/core/src/domain/format/boxes/boxConstants.js +16 -0
  114. package/dist/packages/core/src/domain/format/boxes/boxHeader.js +44 -0
  115. package/dist/packages/core/src/domain/format/boxes/scanBoxes.js +32 -0
  116. package/dist/packages/core/src/domain/format/calibration/CalibrationVersion.js +16 -0
  117. package/dist/packages/core/src/domain/format/calibration/layouts/CalibrationStringLayout.js +34 -0
  118. package/dist/packages/core/src/domain/format/calibration/layouts/LegacyCalibrationLayout.js +46 -0
  119. package/dist/packages/core/src/domain/format/calibration/layouts/MeiCalibrationLayout.js +121 -0
  120. package/dist/packages/core/src/domain/format/calibration/layouts/PolynomialCalibrationLayout.js +46 -0
  121. package/dist/packages/core/src/domain/format/calibration/offsetTokens.js +94 -0
  122. package/dist/packages/core/src/domain/format/calibration/parseOffsetString.js +77 -0
  123. package/dist/packages/core/src/domain/format/calibration/selectCalibration.js +59 -0
  124. package/dist/packages/core/src/domain/format/calibration/v6TermReading.js +20 -0
  125. package/dist/packages/core/src/domain/format/captureOrigin.js +34 -0
  126. package/dist/packages/core/src/domain/format/constants.js +35 -0
  127. package/dist/packages/core/src/domain/format/info/calibrationSources.js +27 -0
  128. package/dist/packages/core/src/domain/format/info/infoFields.js +116 -0
  129. package/dist/packages/core/src/domain/format/info/parseInfoRecord.js +107 -0
  130. package/dist/packages/core/src/domain/format/info/readInfoRecord.js +14 -0
  131. package/dist/packages/core/src/domain/format/layout/detectLensLayout.js +133 -0
  132. package/dist/packages/core/src/domain/format/mp4/hevcCodecString.js +161 -0
  133. package/dist/packages/core/src/domain/format/mp4/keyframeRules.js +81 -0
  134. package/dist/packages/core/src/domain/format/mp4/movieBoxes.js +52 -0
  135. package/dist/packages/core/src/domain/format/mp4/mp4BoxTypes.js +46 -0
  136. package/dist/packages/core/src/domain/format/mp4/mp4Layouts.js +183 -0
  137. package/dist/packages/core/src/domain/format/mp4/parseMovie.js +72 -0
  138. package/dist/packages/core/src/domain/format/mp4/readTable.js +31 -0
  139. package/dist/packages/core/src/domain/format/mp4/sampleLocations.js +76 -0
  140. package/dist/packages/core/src/domain/format/mp4/sampleTiming.js +120 -0
  141. package/dist/packages/core/src/domain/format/mp4/trackHeaders.js +88 -0
  142. package/dist/packages/core/src/domain/format/naming/RecordingFileName.js +70 -0
  143. package/dist/packages/core/src/domain/format/records/TrailerRecords.js +100 -0
  144. package/dist/packages/core/src/domain/format/records/exposure/parseExposureRecord.js +48 -0
  145. package/dist/packages/core/src/domain/format/records/gyro/FloatGyroSampleLayout.js +38 -0
  146. package/dist/packages/core/src/domain/format/records/gyro/RawGyroSampleLayout.js +55 -0
  147. package/dist/packages/core/src/domain/format/records/gyro/SampleColumns.js +89 -0
  148. package/dist/packages/core/src/domain/format/records/gyro/gyroLayouts.js +12 -0
  149. package/dist/packages/core/src/domain/format/records/gyro/parseGyroRecord.js +138 -0
  150. package/dist/packages/core/src/domain/format/records/trim/parseTrimRecord.js +24 -0
  151. package/dist/packages/core/src/domain/format/trailer/RecordHeader.js +23 -0
  152. package/dist/packages/core/src/domain/format/trailer/Trailer.js +23 -0
  153. package/dist/packages/core/src/domain/format/trailer/TrailerFooter.js +27 -0
  154. package/dist/packages/core/src/domain/format/trailer/locateRecords.js +80 -0
  155. package/dist/packages/core/src/domain/format/trailer/parseRecordIndex.js +28 -0
  156. package/dist/packages/core/src/domain/format/trailer/readTrailer.js +60 -0
  157. package/dist/packages/core/src/domain/motion/exposure/ExposureRecord.js +48 -0
  158. package/dist/packages/core/src/domain/motion/gyro/GyroTrack.js +70 -0
  159. package/dist/packages/core/src/domain/motion/gyro/medianStep.js +11 -0
  160. package/dist/packages/core/src/domain/motion/gyro/repairedTimeline.js +101 -0
  161. package/dist/packages/core/src/domain/motion/imu/ImuFrame.js +178 -0
  162. package/dist/packages/core/src/domain/motion/mounting/Mounting.js +131 -0
  163. package/dist/packages/core/src/domain/motion/orientation/OrientationTrack.js +142 -0
  164. package/dist/packages/core/src/domain/motion/orientation/estimateGyroBias.js +72 -0
  165. package/dist/packages/core/src/domain/motion/orientation/gravity.js +97 -0
  166. package/dist/packages/core/src/domain/motion/stabilization/Stabilizer.js +13 -0
  167. package/dist/packages/core/src/domain/motion/stabilization/stabilizers.js +86 -0
  168. package/dist/packages/core/src/domain/motion/timing/CaptureClock.js +41 -0
  169. package/dist/packages/core/src/domain/motion/timing/FrameTimes.js +85 -0
  170. package/dist/packages/core/src/domain/motion/timing/frameTimeSources.js +58 -0
  171. package/dist/packages/core/src/domain/motion/timing/resolveFrameTimes.js +68 -0
  172. package/dist/packages/core/src/domain/optics/EquidistantModel.js +34 -0
  173. package/dist/packages/core/src/domain/optics/MeiDistortion.js +27 -0
  174. package/dist/packages/core/src/domain/optics/MeiModel.js +27 -0
  175. package/dist/packages/core/src/domain/optics/PolynomialModel.js +39 -0
  176. package/dist/packages/core/src/domain/optics/lensPose.js +49 -0
  177. package/dist/packages/core/src/domain/optics/opticsConstants.js +5 -0
  178. package/dist/packages/core/src/domain/optics/scaledProjection.js +30 -0
  179. package/dist/packages/core/src/domain/playback/PlayerState.js +83 -0
  180. package/dist/packages/core/src/domain/rendition/RenditionSpan.js +70 -0
  181. package/dist/packages/core/src/domain/stitching/LensLayout.js +21 -0
  182. package/dist/packages/core/src/domain/stitching/StitchingSetup.js +87 -0
  183. package/dist/packages/core/src/domain/stitching/seamRing.js +4 -0
  184. package/dist/packages/core/src/domain/view/Framing.js +37 -0
  185. package/dist/packages/core/src/domain/view/Picture.js +12 -0
  186. package/dist/packages/core/src/domain/view/PictureQuality.js +26 -0
  187. package/dist/packages/core/src/domain/view/ViewMode.js +9 -0
  188. package/dist/packages/core/src/domain/view/ViewState.js +54 -0
  189. package/dist/packages/core/src/domain/view/lensTilesView.js +64 -0
  190. package/dist/packages/core/src/domain/view/magnification.js +103 -0
  191. package/dist/packages/core/src/domain/view/motionLookView.js +100 -0
  192. package/dist/packages/core/src/domain/view/normalView.js +37 -0
  193. package/dist/packages/core/src/domain/view/panoramaView.js +95 -0
  194. package/dist/packages/core/src/domain/view/rectilinear.js +53 -0
  195. package/dist/packages/core/src/domain/view/screenLayout.js +129 -0
  196. package/dist/packages/core/src/domain/view/screenLook.js +74 -0
  197. package/dist/packages/core/src/domain/view/viewGestures.js +104 -0
  198. package/dist/packages/core/src/domain/view/viewModes.js +31 -0
  199. package/dist/packages/core/src/ports/FramePair.js +6 -0
  200. package/dist/packages/core/src/shared/async/Deferred.js +42 -0
  201. package/dist/packages/core/src/shared/async/RunStop.js +40 -0
  202. package/dist/packages/core/src/shared/async/iteration.js +24 -0
  203. package/dist/packages/core/src/shared/binary/ByteRange.js +50 -0
  204. package/dist/packages/core/src/shared/binary/ByteRangeSet.js +85 -0
  205. package/dist/packages/core/src/shared/binary/ByteReader.js +104 -0
  206. package/dist/packages/core/src/shared/binary/concatenated.js +15 -0
  207. package/dist/packages/core/src/shared/errors/GyroViewError.js +140 -0
  208. package/dist/packages/core/src/shared/errors/reportLater.js +11 -0
  209. package/dist/packages/core/src/shared/events/Outbox.js +68 -0
  210. package/dist/packages/core/src/shared/events/TypedEmitter.js +55 -0
  211. package/dist/packages/core/src/shared/keysOf.js +10 -0
  212. package/dist/packages/core/src/shared/lazy.js +11 -0
  213. package/dist/packages/core/src/shared/mapRecord.js +11 -0
  214. package/dist/packages/core/src/shared/math/Matrix3.js +121 -0
  215. package/dist/packages/core/src/shared/math/Quaternion.js +133 -0
  216. package/dist/packages/core/src/shared/math/Vector3.js +58 -0
  217. package/dist/packages/core/src/shared/math/clamp.js +9 -0
  218. package/dist/packages/core/src/shared/math/countAtOrBelow.js +31 -0
  219. package/dist/packages/core/src/shared/math/minimum.js +17 -0
  220. package/dist/packages/core/src/shared/protobuf/ProtobufMessage.js +143 -0
  221. package/dist/packages/core/src/shared/protobuf/wireFormat.js +16 -0
  222. package/dist/packages/core/src/shared/text/urlPath.js +31 -0
  223. package/dist/packages/core/src/shared/text/utf8.js +12 -0
  224. package/dist/packages/core/src/shared/units/angle.js +22 -0
  225. package/dist/packages/core/src/shared/units/time.js +13 -0
  226. package/dist/packages/player/src/PlayerSource.js +14 -0
  227. package/dist/packages/player/src/browserPlayer.js +20 -0
  228. package/dist/packages/player/src/choices.js +24 -0
  229. package/dist/packages/player/src/composition/AnimationFrameDraws.js +38 -0
  230. package/dist/packages/player/src/composition/BrowserAttitudeSensor.js +191 -0
  231. package/dist/packages/player/src/composition/Disposables.js +31 -0
  232. package/dist/packages/player/src/composition/DrawingBufferFit.js +119 -0
  233. package/dist/packages/player/src/composition/animationFrames.js +9 -0
  234. package/dist/packages/player/src/composition/attitudeSensor.js +18 -0
  235. package/dist/packages/player/src/composition/browserPorts.js +80 -0
  236. package/dist/packages/player/src/composition/buildPipeline.js +186 -0
  237. package/dist/packages/player/src/composition/ensureDecodable.js +62 -0
  238. package/dist/packages/player/src/composition/openInputs.js +120 -0
  239. package/dist/packages/player/src/composition/openRecording.js +41 -0
  240. package/dist/packages/player/src/composition/readInputs.js +25 -0
  241. package/dist/packages/player/src/composition/renditionFrames.js +160 -0
  242. package/dist/packages/player/src/controls/ChoiceMenu.js +125 -0
  243. package/dist/packages/player/src/controls/FullscreenButton.js +29 -0
  244. package/dist/packages/player/src/controls/MotionLookButton.js +34 -0
  245. package/dist/packages/player/src/controls/PictureMenus.js +60 -0
  246. package/dist/packages/player/src/controls/SeekBar.js +126 -0
  247. package/dist/packages/player/src/controls/SoundControls.js +43 -0
  248. package/dist/packages/player/src/controls/TransportButtons.js +28 -0
  249. package/dist/packages/player/src/controls/ViewGestures.js +135 -0
  250. package/dist/packages/player/src/controls/Wording.js +79 -0
  251. package/dist/packages/player/src/controls/controlParts.js +38 -0
  252. package/dist/packages/player/src/controls/controls.js +4 -0
  253. package/dist/packages/player/src/controls/controlsBar.js +33 -0
  254. package/dist/packages/player/src/controls/controlsMarkup.js +100 -0
  255. package/dist/packages/player/src/controls/customControls.js +43 -0
  256. package/dist/packages/player/src/controls/formatTime.js +19 -0
  257. package/dist/packages/player/src/controls/icons.js +66 -0
  258. package/dist/packages/player/src/controls/keyboard.js +120 -0
  259. package/dist/packages/player/src/controls/messages.js +130 -0
  260. package/dist/packages/player/src/controls/nativeFullscreen.js +27 -0
  261. package/dist/packages/player/src/controls/parseMarkup.js +30 -0
  262. package/dist/packages/player/src/controls/resetViewButton.js +11 -0
  263. package/dist/packages/player/src/controls/sliderFill.js +15 -0
  264. package/dist/packages/player/src/element/ElementLoads.js +130 -0
  265. package/dist/packages/player/src/element/FullscreenToggle.js +93 -0
  266. package/dist/packages/player/src/element/GyroViewElement.js +358 -0
  267. package/dist/packages/player/src/element/IdleWatcher.js +71 -0
  268. package/dist/packages/player/src/element/PlayerCanvas.js +72 -0
  269. package/dist/packages/player/src/element/TypedEventElement.js +22 -0
  270. package/dist/packages/player/src/element/accessibleRegion.js +19 -0
  271. package/dist/packages/player/src/element/attributeNames.js +62 -0
  272. package/dist/packages/player/src/element/attributes.js +123 -0
  273. package/dist/packages/player/src/element/defineGyroView.js +20 -0
  274. package/dist/packages/player/src/element/earlyProperties.js +35 -0
  275. package/dist/packages/player/src/element/elementProperties.js +34 -0
  276. package/dist/packages/player/src/element/elementSource.js +39 -0
  277. package/dist/packages/player/src/element/fetchProperty.js +48 -0
  278. package/dist/packages/player/src/element/liveSettings.js +137 -0
  279. package/dist/packages/player/src/element/playbackAttributes.js +52 -0
  280. package/dist/packages/player/src/element/playerEventMirror.js +33 -0
  281. package/dist/packages/player/src/element/reflectedProperties.js +96 -0
  282. package/dist/packages/player/src/element/styles.js +4 -0
  283. package/dist/packages/player/src/element/template.js +46 -0
  284. package/dist/packages/player/src/inspectRecording.js +21 -0
  285. package/dist/packages/player/src/player/FrameLoop.js +35 -0
  286. package/dist/packages/player/src/player/MotionLook.js +150 -0
  287. package/dist/packages/player/src/player/PictureSettings.js +59 -0
  288. package/dist/packages/player/src/player/PlaybackStarts.js +38 -0
  289. package/dist/packages/player/src/player/Player.js +379 -0
  290. package/dist/packages/player/src/player/PlayerEvents.js +28 -0
  291. package/dist/packages/player/src/player/PlayerPhase.js +38 -0
  292. package/dist/packages/player/src/player/PlayerSound.js +60 -0
  293. package/dist/packages/player/src/player/PlayerView.js +143 -0
  294. package/dist/packages/player/src/player/SessionRelay.js +74 -0
  295. package/dist/packages/player/src/player/StatusAnnouncer.js +29 -0
  296. package/dist/packages/player/src/player/ensureFinite.js +26 -0
  297. package/dist/packages/player/src/player/loadRecording.js +47 -0
  298. package/dist/packages/player/src/player/transportEvents.js +30 -0
  299. package/dist/packages/player/src/player/viewAngles.js +17 -0
  300. package/dist/packages/player/src/rendition.js +52 -0
  301. package/dist/standalone.js +5633 -0
  302. package/package.json +70 -3
@@ -0,0 +1,1204 @@
1
+ /**
2
+ * A page's own way of sending the player's requests for a recording, in place of the platform's
3
+ * `fetch`: to add a header the server asks for, such as `Authorization` with a token read afresh
4
+ * for each request, or to sign each request. `window.fetch` itself fits.
5
+ *
6
+ * It is called on its own (without `this`), for HEAD and for byte-range GET requests, with the
7
+ * URL as a string and `init` holding `method`, `headers` (a plain object with `Range`), `cache`,
8
+ * the `signal` that ends the request when there is one, and `credentials` when `crossorigin`
9
+ * sets them. It must pass `init` on as given, adding only its own headers: without
10
+ * `cache: 'no-store'` browsers may answer a range from a cache entry they hold half of (ADR
11
+ * 0013), and without the signal a recording given up goes on downloading. It must resolve to the
12
+ * server's `Response` itself, whose status, type and headers the player reads. After a request
13
+ * fails, it may be called once more with `mode: 'no-cors'`, only to learn whether the server is
14
+ * reachable; browsers send no `Authorization` header with such a request.
15
+ */
16
+ export type RecordingFetch = (url: string, init: RequestInit) => Promise<Response>;
17
+ /**
18
+ * A recording reachable over HTTP with Range support (see README, "Serving recordings").
19
+ */
20
+ export interface UrlInput {
21
+ readonly url: string;
22
+ /**
23
+ * Whether every request for the recording carries the visitor's cookies, in fetch's terms:
24
+ * `include` sends them to any origin, which must then allow the page's origin by name and
25
+ * with `Access-Control-Allow-Credentials: true`. Unset, the player's shared request settings
26
+ * decide, and fetch's `same-origin` when they do not. The element's
27
+ * `crossorigin="use-credentials"` sets `include`.
28
+ */
29
+ readonly credentials?: RequestCredentials | undefined;
30
+ /**
31
+ * Sends every request for the recording, its other lens's file included, in place of the
32
+ * platform's `fetch` and of a `fetch` the player's shared request settings name. The element's
33
+ * `fetch` property sets it.
34
+ */
35
+ readonly fetch?: RecordingFetch | undefined;
36
+ }
37
+ /**
38
+ * A recording already in the browser: a `File` from a picker or a drop.
39
+ */
40
+ export interface BlobInput {
41
+ readonly blob: Blob;
42
+ readonly name: string;
43
+ }
44
+ export type MediaInput = UrlInput | BlobInput;
45
+ /**
46
+ * Everything that names what to play. The second input is the other lens's file of a
47
+ * split-file recording, found beside the main one by itself when left out.
48
+ */
49
+ export interface PlayerSource {
50
+ readonly main: MediaInput;
51
+ readonly second?: MediaInput | undefined;
52
+ }
53
+ declare const brand: unique symbol;
54
+ type Brand<Base, Name extends string> = Base & {
55
+ readonly [brand]: Name;
56
+ };
57
+ declare const space: unique symbol;
58
+ interface Size<Space extends string> {
59
+ readonly width: number;
60
+ readonly height: number;
61
+ readonly [space]?: Space;
62
+ }
63
+ declare const CalibrationVersion: {
64
+ readonly Legacy: 1;
65
+ readonly Polynomial: 2;
66
+ readonly Mei: 3;
67
+ readonly ExtendedMei: 6;
68
+ };
69
+ type CalibrationVersion = (typeof CalibrationVersion)[keyof typeof CalibrationVersion];
70
+ type Milliseconds = Brand<number, "Milliseconds">;
71
+ type Seconds = Brand<number, "Seconds">;
72
+ type FrameTimeSourceName = "exposure-record" | "track-timestamps" | "nominal";
73
+ type LensLayoutKind = "multi-track" | "split-files" | "packed";
74
+ type FileLayoutHint = Exclude<LensLayoutKind, "packed">;
75
+ type TrackOrderHint = "stream-10-first" | "stream-00-first";
76
+ type LensDimension = Size<"video pixels">;
77
+ interface SensorRanges {
78
+ readonly accelerometerG: number | undefined;
79
+ readonly gyroscopeDps: number | undefined;
80
+ }
81
+ interface WindowCrop {
82
+ readonly sensorWidth: number | undefined;
83
+ readonly sensorHeight: number | undefined;
84
+ readonly cropWidth: number | undefined;
85
+ readonly cropHeight: number | undefined;
86
+ readonly cropOffsetX: number | undefined;
87
+ readonly cropOffsetY: number | undefined;
88
+ }
89
+ interface CalibrationStrings {
90
+ readonly offset: string | undefined;
91
+ readonly offsetV2: string | undefined;
92
+ readonly offsetV3: string | undefined;
93
+ readonly offsetV6: string | undefined;
94
+ }
95
+ /**
96
+ * Everything the player learns from the info record. Absent fields are `undefined`; nothing here
97
+ * is assumed present except on cameras where a field has been observed.
98
+ */
99
+ export interface RecordingInfo {
100
+ readonly serialNumber: string | undefined;
101
+ readonly model: string | undefined;
102
+ readonly firmware: string | undefined;
103
+ readonly calibration: CalibrationStrings;
104
+ readonly dimension: LensDimension | undefined;
105
+ readonly frameRate: number | undefined;
106
+ readonly captureMode: string | undefined;
107
+ /**
108
+ * Capture-clock time of the first encoded frame, in the unit the gyro record uses
109
+ * (microseconds for the raw layout, milliseconds for the float layout). Resolve it through
110
+ * `firstFrameCaptureTime`, never by hand.
111
+ */
112
+ readonly firstFrameTimestamp: number | undefined;
113
+ /**
114
+ * Rolling-shutter readout duration of one frame.
115
+ */
116
+ readonly readoutTime: Seconds | undefined;
117
+ readonly windowCrop: WindowCrop | undefined;
118
+ /**
119
+ * How much later than the frames the gyro samples are stamped.
120
+ */
121
+ readonly gyroOffset: Milliseconds | undefined;
122
+ readonly gyroType: number | undefined;
123
+ readonly isRawGyro: boolean | undefined;
124
+ /**
125
+ * The frame time source the camera says to trust first (`pts_type`).
126
+ */
127
+ readonly preferredFrameTimeSource: FrameTimeSourceName | undefined;
128
+ readonly sensorRanges: SensorRanges | undefined;
129
+ readonly fileLayout: FileLayoutHint | undefined;
130
+ readonly trackOrder: TrackOrderHint | undefined;
131
+ }
132
+ type TrailerWrapper = "inst-box" | "bare";
133
+ /**
134
+ * One top-level box of the file: its four-character type, where it starts and how long it is.
135
+ */
136
+ export interface BoxSummary {
137
+ readonly type: string;
138
+ readonly offset: number;
139
+ readonly size: number;
140
+ }
141
+ export interface RecordSummary {
142
+ readonly id: number;
143
+ readonly format: number;
144
+ readonly offset: number;
145
+ readonly size: number;
146
+ }
147
+ export interface LensSummary {
148
+ readonly lensIndex: number;
149
+ readonly model: string;
150
+ readonly principalPoint: readonly [
151
+ x: number,
152
+ y: number
153
+ ];
154
+ readonly orientationDegrees: readonly [
155
+ yaw: number,
156
+ pitch: number,
157
+ roll: number
158
+ ];
159
+ readonly translationMetres: readonly [
160
+ x: number,
161
+ y: number,
162
+ z: number
163
+ ];
164
+ }
165
+ export interface CalibrationSummary {
166
+ readonly version: CalibrationVersion;
167
+ readonly canvas: readonly [
168
+ width: number,
169
+ height: number
170
+ ];
171
+ readonly lenses: readonly LensSummary[];
172
+ }
173
+ export interface GyroSummary {
174
+ readonly layout: string;
175
+ readonly samples: number;
176
+ readonly strayBytes: number;
177
+ /**
178
+ * Samples left out because their bytes cannot be a reading; a wrong layout guess shows here.
179
+ */
180
+ readonly damagedSamples: number;
181
+ /**
182
+ * Slots the camera left all zero, as it leaves the first ones it never wrote; no damage.
183
+ */
184
+ readonly unwrittenSamples: number;
185
+ /**
186
+ * Stamps put back where their neighbours say they belong: glitched stamps. A wrong stamp unit
187
+ * scales them all alike and shows in the mean interval and the span instead.
188
+ */
189
+ readonly mendedStamps: number;
190
+ readonly spanSeconds: number;
191
+ readonly meanIntervalUs: number | undefined;
192
+ /**
193
+ * Mean |acceleration| over the leading samples; about 1 g proves the range scaling. Undefined
194
+ * for a record without samples.
195
+ */
196
+ readonly meanAccelerationMagnitudeG: number | undefined;
197
+ }
198
+ /**
199
+ * A gyro record whose sample layout could not be told, and why.
200
+ */
201
+ export interface UnreadableGyro {
202
+ readonly unreadable: string;
203
+ }
204
+ /**
205
+ * An exposure record the trailer lists that did not parse: an entry no clock could have stamped
206
+ * or no shutter could take.
207
+ */
208
+ export interface DamagedExposure {
209
+ readonly damaged: true;
210
+ }
211
+ /**
212
+ * An exposure record the trailer lists that was not read, and why.
213
+ */
214
+ export interface UnreadExposure {
215
+ readonly unread: string;
216
+ }
217
+ /**
218
+ * The record's entries; the times and the mean are undefined for a record without any, so the
219
+ * summary stays plain data that serializes as it reads.
220
+ */
221
+ export interface ExposureSummary {
222
+ readonly entries: number;
223
+ readonly firstCaptureTimeUs: number | undefined;
224
+ readonly lastCaptureTimeUs: number | undefined;
225
+ readonly meanShutterTimeSeconds: number | undefined;
226
+ /**
227
+ * Index of the entry that belongs to the first encoded frame, when the info record says.
228
+ */
229
+ readonly firstEncodedFrameEntry: number | undefined;
230
+ }
231
+ export type ExposureReport = ExposureSummary | DamagedExposure | UnreadExposure;
232
+ /**
233
+ * What a recording's file holds, as plain data: its boxes, the trailer and its records, the info
234
+ * record, the calibration and summaries of the gyro and exposure records. Serializable, so a
235
+ * report, a page or a test can take it without the domain objects.
236
+ */
237
+ export interface RecordingInspection {
238
+ readonly fileSize: number;
239
+ readonly boxes: readonly BoxSummary[];
240
+ readonly trailerWrapper: TrailerWrapper;
241
+ readonly trailerVersion: number;
242
+ readonly payloadStart: number;
243
+ readonly records: readonly RecordSummary[];
244
+ readonly info: RecordingInfo;
245
+ /**
246
+ * Undefined when the recording carries no usable calibration string.
247
+ */
248
+ readonly calibration: CalibrationSummary | undefined;
249
+ /**
250
+ * Why calibration strings were skipped, whether or not one was usable.
251
+ */
252
+ readonly calibrationWarnings: readonly string[];
253
+ readonly gyro: GyroSummary | UnreadableGyro | undefined;
254
+ readonly exposure: ExposureReport | undefined;
255
+ }
256
+ declare const COLOUR_PRIMARIES: readonly [
257
+ "bt709",
258
+ "bt470bg",
259
+ "smpte170m",
260
+ "bt2020",
261
+ "smpte432"
262
+ ];
263
+ declare const TRANSFER_CHARACTERISTICS: readonly [
264
+ "bt709",
265
+ "smpte170m",
266
+ "iec61966-2-1",
267
+ "linear",
268
+ "pq",
269
+ "hlg"
270
+ ];
271
+ declare const MATRIX_COEFFICIENTS: readonly [
272
+ "rgb",
273
+ "bt709",
274
+ "bt470bg",
275
+ "smpte170m",
276
+ "bt2020-ncl"
277
+ ];
278
+ type Unspecified = "unspecified";
279
+ export type ColourPrimaries = (typeof COLOUR_PRIMARIES)[number] | Unspecified;
280
+ export type TransferCharacteristics = (typeof TRANSFER_CHARACTERISTICS)[number] | Unspecified;
281
+ export type MatrixCoefficients = (typeof MATRIX_COEFFICIENTS)[number] | Unspecified;
282
+ export type ColourRange = "full" | "limited" | Unspecified;
283
+ export interface TrackColour {
284
+ readonly primaries: ColourPrimaries;
285
+ readonly transfer: TransferCharacteristics;
286
+ readonly matrix: MatrixCoefficients;
287
+ readonly range: ColourRange;
288
+ }
289
+ interface VideoTrackDescription {
290
+ readonly trackIndex: number;
291
+ readonly codedWidth: number;
292
+ readonly codedHeight: number;
293
+ /**
294
+ * WebCodecs codec string, for example `hvc1.1.6.L153.B0` or `avc1.640033`.
295
+ */
296
+ readonly codec: string;
297
+ readonly colour: TrackColour;
298
+ }
299
+ export declare const STABILIZATION_MODES: readonly [
300
+ "off",
301
+ "lock",
302
+ "horizon",
303
+ "follow"
304
+ ];
305
+ export type StabilizationMode = (typeof STABILIZATION_MODES)[number];
306
+ /**
307
+ * How finely the renderer reads the lens images for each screen pixel, and how many device pixels
308
+ * per CSS pixel the drawing buffer may hold ({@link pixelRatioCapOf}): `fast` reads one bilinear
309
+ * tap of the frame as decoded; `balanced` reads through a mip chain over the pixel's footprint,
310
+ * which stops the shimmer where the frame is minified; `high` adds extra taps (ADR 0024).
311
+ */
312
+ export type PictureQuality = "fast" | "balanced" | "high";
313
+ export declare const PICTURE_QUALITIES: readonly PictureQuality[];
314
+ interface ScreenPoint {
315
+ readonly x: number;
316
+ readonly y: number;
317
+ }
318
+ interface DragDelta {
319
+ readonly x: number;
320
+ readonly y: number;
321
+ }
322
+ /**
323
+ * What the player shows: `raw-lenses` is each lens's decoded image on its own, unstitched, and
324
+ * what the player opens on; `equirectangular` is the whole stitched sphere as a 2:1 panorama;
325
+ * `normal` is a rectilinear window into the stitched sphere that the viewer turns and zooms.
326
+ * The order is the view menu's, first to last (ADR 0022).
327
+ */
328
+ export type ViewMode = "raw-lenses" | "equirectangular" | "normal";
329
+ export declare const VIEW_MODES: readonly ViewMode[];
330
+ /**
331
+ * Stable machine-readable failure codes. Embedders switch on these; messages are for humans.
332
+ */
333
+ export declare const GYRO_VIEW_ERROR_CODES: readonly [
334
+ "binary-out-of-bounds",
335
+ "binary-unsafe-integer",
336
+ "codec-unsupported",
337
+ "cors",
338
+ "decode",
339
+ "embed-destroyed",
340
+ "embed-unreachable",
341
+ "index-out-of-range",
342
+ "invalid-argument",
343
+ "invalid-byte-range",
344
+ "invalid-calibration",
345
+ "invalid-protobuf",
346
+ "invalid-trailer",
347
+ "invariant-violation",
348
+ "missing-second-file",
349
+ "no-calibration",
350
+ "no-info-record",
351
+ "no-key-frame",
352
+ "no-source",
353
+ "play-interrupted",
354
+ "playback-blocked",
355
+ "range-unsupported",
356
+ "render-unavailable",
357
+ "source-changed",
358
+ "source-truncated",
359
+ "source-unreadable",
360
+ "unsupported-calibration",
361
+ "unsupported-container",
362
+ "unsupported-gyro-record",
363
+ "unsupported-info-format",
364
+ "unsupported-layout",
365
+ "webcodecs-unavailable"
366
+ ];
367
+ export type GyroViewErrorCode = (typeof GYRO_VIEW_ERROR_CODES)[number];
368
+ /**
369
+ * Whose side a failure is on, for embedders that handle failures by kind: the browser cannot
370
+ * decode or draw the recording, the file is not one the player can play, its bytes could not be
371
+ * read, the page misused the API, or the player failed in a way it did not expect.
372
+ */
373
+ export declare const GYRO_VIEW_ERROR_CATEGORIES: readonly [
374
+ "browser",
375
+ "recording",
376
+ "source",
377
+ "usage",
378
+ "internal"
379
+ ];
380
+ export type GyroViewErrorCategory = (typeof GYRO_VIEW_ERROR_CATEGORIES)[number];
381
+ export declare function isGyroViewErrorCode(value: unknown): value is GyroViewErrorCode;
382
+ export declare class GyroViewError extends Error {
383
+ readonly code: GyroViewErrorCode;
384
+ /**
385
+ * Its own property rather than a getter, so a serialized or logged copy of the error keeps it.
386
+ */
387
+ readonly category: GyroViewErrorCategory;
388
+ constructor(code: GyroViewErrorCode, message: string, options?: ErrorOptions);
389
+ }
390
+ export declare function hasErrorCode(error: unknown, code: GyroViewErrorCode): boolean;
391
+ type Listener<Payload> = (payload: Payload) => void;
392
+ interface Listenable<Events extends object> {
393
+ on<Name extends keyof Events>(name: Name, listener: Listener<Events[Name]>): () => void;
394
+ }
395
+ type PlayerState = "ready" | "playing" | "buffering" | "paused" | "seeking" | "ended" | "error" | "disposed";
396
+ export interface ImuFrameSummary {
397
+ readonly name: string;
398
+ readonly isVerified: boolean;
399
+ }
400
+ /**
401
+ * What the player learned about a recording while opening it, for the `ready` event: enough for
402
+ * an embedder to know which camera, layout and degraded features it got.
403
+ */
404
+ export interface PlayerMetadata {
405
+ readonly model: string | undefined;
406
+ readonly firmware: string | undefined;
407
+ readonly captureMode: string | undefined;
408
+ readonly layout: LensLayoutKind;
409
+ readonly layoutEvidence: readonly string[];
410
+ /**
411
+ * The lens tracks in lens order.
412
+ */
413
+ readonly tracks: readonly VideoTrackDescription[];
414
+ readonly calibrationVersion: CalibrationVersion;
415
+ readonly frameTimeSource: FrameTimeSourceName | undefined;
416
+ readonly hasGyro: boolean;
417
+ readonly imuFrame: ImuFrameSummary | undefined;
418
+ readonly hasAudio: boolean;
419
+ /**
420
+ * In seconds.
421
+ */
422
+ readonly duration: number;
423
+ }
424
+ /**
425
+ * The DOM the pipeline draws on and plays sound through; both borrowed from the element.
426
+ */
427
+ /**
428
+ * Where the player draws and sounds. The canvas is read at each load and each measure, so a host
429
+ * may hand a fresh one between loads, as the element does for one whose WebGL context is gone.
430
+ */
431
+ export interface PipelineHost {
432
+ readonly canvas: HTMLCanvasElement;
433
+ readonly audio: HTMLMediaElement;
434
+ }
435
+ /**
436
+ * A view as a page gives it and gets it back: yaw positive to the right, pitch positive up, and
437
+ * the horizontal field of view, all in degrees.
438
+ */
439
+ export interface ViewAngles {
440
+ readonly yaw: number;
441
+ readonly pitch: number;
442
+ readonly fieldOfView: number;
443
+ }
444
+ /**
445
+ * What concerns one load only. The settings (view, view mode, motion look, stabilization, gain
446
+ * matching, sound, loop) belong to the player and carry over from load to load; set them on the
447
+ * player.
448
+ */
449
+ export interface LoadOptions {
450
+ /**
451
+ * Start as soon as the recording is ready; a refusal by the autoplay policy is a warning.
452
+ */
453
+ readonly autoplay?: boolean;
454
+ /**
455
+ * Decode the first frame as soon as the recording is ready, so it shows instead of a black
456
+ * canvas. Default true; off keeps the decoders idle until play.
457
+ */
458
+ readonly preload?: boolean;
459
+ }
460
+ /**
461
+ * The session's states plus the two only the player knows: nothing loaded, and loading. A
462
+ * recording is `seeking` from a seek until the picture there is drawn.
463
+ */
464
+ export type PlayerStatus = "idle" | "loading" | PlayerState;
465
+ /**
466
+ * Motion look as it stands: `unavailable` where the device reports no attitude or access was
467
+ * refused, `off`, or `on`, the device turning the normal view (ADR 0040).
468
+ */
469
+ export type MotionLookState = "unavailable" | "off" | "on";
470
+ /**
471
+ * The sound as it is now: volume from 0 to 1, and whether it is muted.
472
+ */
473
+ export interface SoundLevel {
474
+ readonly volume: number;
475
+ readonly isMuted: boolean;
476
+ }
477
+ /**
478
+ * What a `warning` is about, for a page that acts on some and not others:
479
+ * - `recording-degraded`: the recording lacks, or has damaged, data the player works around (no
480
+ * gyro, an unverified IMU frame, fallback frame times or calibration); `ready`'s metadata says
481
+ * what it got.
482
+ * - `no-sound`: the recording has no sound, or none this browser plays; a silent clock runs.
483
+ * - `autoplay-blocked`: the browser waits for a user gesture before it starts playback.
484
+ * - `playback-failed`: a start (a press, autoplay) or the seek bar's preview failed.
485
+ * - `ignored-attribute`: an attribute's value names nothing the element knows; the setting stays.
486
+ * - `refused-property`: a property set before the element was defined was refused.
487
+ * - `motion-look-refused`: the viewer, or an iframe's `allow`, refused access to the device's
488
+ * attitude; motion look is unavailable.
489
+ * - `motion-look-needs-gesture`: motion look was started outside a user gesture, where iOS does
490
+ * not ask; it stays off.
491
+ */
492
+ export type WarningCode = "recording-degraded" | "no-sound" | "autoplay-blocked" | "playback-failed" | "ignored-attribute" | "refused-property" | "motion-look-refused" | "motion-look-needs-gesture";
493
+ export interface PlayerWarning {
494
+ readonly code: WarningCode;
495
+ /**
496
+ * What happened exactly, for a developer.
497
+ */
498
+ readonly message: string;
499
+ }
500
+ export interface PlayerEvents {
501
+ readonly statuschange: PlayerStatus;
502
+ readonly ready: PlayerMetadata;
503
+ readonly play: undefined;
504
+ /**
505
+ * Frames are ready and the clock runs: after `play` or after `waiting`.
506
+ */
507
+ readonly playing: undefined;
508
+ /**
509
+ * Playback holds for frames: on starting, after a seek, or when decoding falls behind.
510
+ */
511
+ readonly waiting: undefined;
512
+ readonly pause: undefined;
513
+ readonly ended: undefined;
514
+ /**
515
+ * The media time, every quarter second of playback and on a pause, a seek or the end.
516
+ */
517
+ readonly timeupdate: number;
518
+ readonly seeking: number;
519
+ readonly seeked: number;
520
+ /**
521
+ * A picture was drawn; the media time it shows.
522
+ */
523
+ readonly frame: number;
524
+ readonly viewchange: ViewAngles;
525
+ readonly viewmodechange: ViewMode;
526
+ readonly motionlookchange: MotionLookState;
527
+ readonly stabilizationchange: StabilizationMode;
528
+ /**
529
+ * The picture quality changed, to the one named.
530
+ */
531
+ readonly qualitychange: PictureQuality;
532
+ /**
533
+ * The volume or the mute changed, from whatever changed it.
534
+ */
535
+ readonly volumechange: SoundLevel;
536
+ /**
537
+ * Something the player worked around; the code says what, the message says it exactly.
538
+ */
539
+ readonly warning: PlayerWarning;
540
+ readonly error: GyroViewError;
541
+ }
542
+ /**
543
+ * The player without the element, which `createBrowserPlayer` gives: it plays one recording at a
544
+ * time on the canvas and audio element it was handed, reports in media-element events, and keeps
545
+ * its settings (view, view mode, motion look, stabilization, gain matching, sound, loop) from
546
+ * load to load. `<gyro-view>` is a facade over it.
547
+ */
548
+ export declare class Player {
549
+ private readonly parts;
550
+ /**
551
+ * What the player announces, to listen to: only the player and its parts emit.
552
+ */
553
+ readonly events: Listenable<PlayerEvents>;
554
+ private readonly emitter;
555
+ /**
556
+ * What the player and its parts announce, heard once each change is whole (ADR 0021).
557
+ */
558
+ private readonly outbox;
559
+ private readonly statuses;
560
+ private readonly loop;
561
+ private phase;
562
+ private readonly viewing;
563
+ private readonly motion;
564
+ private readonly picture;
565
+ /**
566
+ * A seek asked for before a recording was ready, where the next one starts.
567
+ */
568
+ private pendingStartTime;
569
+ private readonly sound;
570
+ private readonly relay;
571
+ private readonly starts;
572
+ /**
573
+ * Whether the recording plays again from the start at its end; kept across loads.
574
+ */
575
+ private shouldLoop;
576
+ /**
577
+ * Past `dispose`: a listener of the idle it announces must not load again.
578
+ */
579
+ private isDisposed;
580
+ get status(): PlayerStatus;
581
+ get metadata(): PlayerMetadata | undefined;
582
+ get currentTime(): number;
583
+ get duration(): number;
584
+ /**
585
+ * False while playing or holding for frames, as a media element's `paused`.
586
+ */
587
+ get isPaused(): boolean;
588
+ get view(): ViewAngles;
589
+ get viewMode(): ViewMode;
590
+ /**
591
+ * Whether a drag moves the picture as it is framed now; the view mode decides.
592
+ */
593
+ get canPan(): boolean;
594
+ /**
595
+ * Whether turning the device turns the normal view: `unavailable` where the device reports no
596
+ * attitude or access was refused.
597
+ */
598
+ get motionLook(): MotionLookState;
599
+ get stabilization(): StabilizationMode;
600
+ get quality(): PictureQuality;
601
+ get isLooping(): boolean;
602
+ get volume(): number;
603
+ get isMuted(): boolean;
604
+ /**
605
+ * Whether `setVolume` changes anything on this platform; iOS leaves media at the device's volume.
606
+ */
607
+ get canSetVolume(): boolean;
608
+ /**
609
+ * Replaces whatever was loaded. Resolves once the recording is ready, `autoplay` starting it
610
+ * then, a refusal a warning; rejects with the failure after reporting it as an `error` event.
611
+ * A load that a newer load or `unload` supersedes resolves quietly.
612
+ */
613
+ load(source: PlayerSource, options?: LoadOptions): Promise<void>;
614
+ unload(): void;
615
+ /**
616
+ * Starts playback, after a load in progress is ready, and resolves once it runs, as a media
617
+ * element's `play()` does. Rejects with the load's failure, with `playback-blocked` when the
618
+ * browser wants a user gesture first, with `no-source` when nothing is loaded or loading, and
619
+ * with `play-interrupted` when a newer load or `unload` replaced the load it waited for.
620
+ */
621
+ play(): Promise<void>;
622
+ pause(): void;
623
+ /**
624
+ * Pauses, or starts playing and reports a refused start as a `warning`: what a tap on the
625
+ * picture or a play button does.
626
+ */
627
+ togglePlayback(): void;
628
+ stop(): void;
629
+ /**
630
+ * Seeks exactly to `time` seconds; while a recording is loading, before one is, or after its
631
+ * playback failed, the next one starts there, as a media element's default playback start
632
+ * position has it.
633
+ */
634
+ seek(time: number): void;
635
+ /**
636
+ * Seeks to the key frame at or before `time` seconds: quick to show while a seek bar is dragged.
637
+ */
638
+ scrub(time: number): Promise<void>;
639
+ setView(view: ViewAngles): void;
640
+ /**
641
+ * Points the normal view at `yaw` and `pitch`, in degrees: yaw positive to the right, pitch
642
+ * positive up.
643
+ */
644
+ lookAt(yaw: number, pitch: number): void;
645
+ /**
646
+ * The viewer dragged the picture by `delta` CSS pixels across the canvas.
647
+ */
648
+ pan(delta: DragDelta): void;
649
+ /**
650
+ * The viewer turned by the given angles in degrees, as the arrow keys do.
651
+ */
652
+ turn(yawDelta: number, pitchDelta: number): void;
653
+ /**
654
+ * Zooms by `steps` (positive zooms in) toward `focus`, a point of the canvas as fractions of its
655
+ * size; about the centre when none is given.
656
+ */
657
+ zoom(steps: number, focus?: ScreenPoint): void;
658
+ resetView(): void;
659
+ setViewMode(mode: ViewMode): void;
660
+ /**
661
+ * Lets the device turn the normal view, as a window into the recording: its tilt and roll
662
+ * hold the pitch and keep the horizon level, drags turn the heading alone. Call it from a tap's
663
+ * handler: iOS asks the viewer for access there and refuses it anywhere else. Resolves with the
664
+ * state it ends in; a refusal is a warning, never a rejection.
665
+ */
666
+ startMotionLook(): Promise<MotionLookState>;
667
+ /**
668
+ * Gives the view back to the pointer, level, looking where it looked.
669
+ */
670
+ stopMotionLook(): void;
671
+ setStabilization(mode: StabilizationMode): void;
672
+ /**
673
+ * How finely the lens images are read and how many device pixels are drawn; kept across loads.
674
+ */
675
+ setQuality(quality: PictureQuality): void;
676
+ setLooping(isLooping: boolean): void;
677
+ /**
678
+ * Whether the lenses' exposure is matched along the seam; kept across loads.
679
+ */
680
+ setGainMatching(isEnabled: boolean): void;
681
+ setVolume(volume: number): void;
682
+ setMuted(isMuted: boolean): void;
683
+ dispose(): void;
684
+ private readonly tick;
685
+ private get loaded();
686
+ private complete;
687
+ private startAtPendingTime;
688
+ private attach;
689
+ /**
690
+ * Lets go of whatever is loading or loaded, announcing nothing.
691
+ */
692
+ private release;
693
+ private failWith;
694
+ }
695
+ /**
696
+ * The element's labels: what its buttons, sliders, menus and overlays are called, and its own
697
+ * name for assistive technology.
698
+ */
699
+ export interface GyroViewLabels {
700
+ /**
701
+ * The element's name, unless the page names it.
702
+ */
703
+ readonly player: string;
704
+ readonly loading: string;
705
+ readonly play: string;
706
+ readonly pause: string;
707
+ readonly seek: string;
708
+ /**
709
+ * How the seek bar tells assistive technology where it is: `{time}` and `{duration}` are
710
+ * replaced.
711
+ */
712
+ readonly position: string;
713
+ readonly mute: string;
714
+ readonly volume: string;
715
+ readonly resetView: string;
716
+ /**
717
+ * The toggle that lets the device's own turns turn the normal view.
718
+ */
719
+ readonly motionLook: string;
720
+ readonly stabilization: string;
721
+ readonly viewMode: string;
722
+ readonly fullscreen: string;
723
+ /**
724
+ * The button that closes a menu shown over the whole player, as it is on a narrow one.
725
+ */
726
+ readonly close: string;
727
+ }
728
+ type LabelName = keyof GyroViewLabels;
729
+ /**
730
+ * Every word `<gyro-view>` shows, or says to assistive technology: English by default, each
731
+ * replaceable through the element's `messages` property.
732
+ */
733
+ export interface GyroViewMessages {
734
+ readonly labels: GyroViewLabels;
735
+ readonly stabilizationModes: Readonly<Record<StabilizationMode, string>>;
736
+ /**
737
+ * One line under each choice of the Stabilization menu, where there is room for it.
738
+ */
739
+ readonly stabilizationModeDescriptions: Readonly<Record<StabilizationMode, string>>;
740
+ readonly viewModes: Readonly<Record<ViewMode, string>>;
741
+ /**
742
+ * One line under each choice of the View menu, where there is room for it.
743
+ */
744
+ readonly viewModeDescriptions: Readonly<Record<ViewMode, string>>;
745
+ /**
746
+ * What a visitor reads when a recording cannot play, by the failure's code. The `error`
747
+ * event carries the developer's account of it.
748
+ */
749
+ readonly errors: Readonly<Record<GyroViewErrorCode, string>>;
750
+ }
751
+ /**
752
+ * The words a page gives: any of them, table by table.
753
+ */
754
+ export type GyroViewMessageOverrides = {
755
+ readonly [Table in keyof GyroViewMessages]?: Partial<GyroViewMessages[Table]>;
756
+ };
757
+ declare class Wording {
758
+ private words;
759
+ get current(): GyroViewMessages;
760
+ /**
761
+ * The defaults with the page's own words in their place; `write` shows them.
762
+ */
763
+ replace(overrides: unknown): void;
764
+ /**
765
+ * Calls `element` by the label `name` names, now and after every change of words.
766
+ */
767
+ label(element: Element, name: LabelName): void;
768
+ /**
769
+ * Tells the visitor in `element` that the recording failed with `code`.
770
+ */
771
+ showError(element: Element, code: GyroViewErrorCode): void;
772
+ /**
773
+ * Fills in every word below `root` that its markup names.
774
+ */
775
+ write(root: ParentNode): void;
776
+ private writeLabel;
777
+ private writeText;
778
+ private writeChoiceText;
779
+ private writeError;
780
+ }
781
+ interface ControlsHost {
782
+ readonly player: Player;
783
+ /**
784
+ * The words the controls say, the page's where it gave its own.
785
+ */
786
+ readonly wording: Wording;
787
+ /**
788
+ * Plays or pauses; the element reports a refused start.
789
+ */
790
+ togglePlay(): void;
791
+ toggleFullscreen(): void;
792
+ /**
793
+ * Whether the element fills the screen, through the Fullscreen API or pinned over the page.
794
+ */
795
+ isFullscreen(): boolean;
796
+ warn(warning: PlayerWarning): void;
797
+ }
798
+ interface KeyboardHost extends Pick<ControlsHost, "togglePlay" | "toggleFullscreen" | "isFullscreen"> {
799
+ readonly player: Pick<Player, "currentTime" | "seek" | "stop" | "turn" | "zoom" | "resetView" | "isMuted" | "setMuted">;
800
+ exitFullscreen(): void;
801
+ }
802
+ type PlaybackToggle = Pick<Player, "togglePlayback">;
803
+ export interface ViewGestureOptions {
804
+ /**
805
+ * Hears a tap on the surface, a press without a drag, with the kind of pointer that made it
806
+ * (`mouse`, `touch`, `pen`). By default a tap plays or pauses, as on `<gyro-view>`.
807
+ */
808
+ readonly onTap?: (pointerType: string) => void;
809
+ }
810
+ export interface KeyboardOptions {
811
+ /**
812
+ * What F does; by default the target fills the screen through the Fullscreen API, which
813
+ * iPhone Safari offers to video elements only.
814
+ */
815
+ readonly toggleFullscreen?: () => void;
816
+ }
817
+ /**
818
+ * The gestures `<gyro-view>` answers, for an interface of a page's own around the headless
819
+ * player: a drag looks around (or moves a zoomed picture), a pinch or a wheel turn zooms toward
820
+ * the fingers or the pointer, a tap plays or pauses. `surface` is the canvas or an element over
821
+ * it. Returns what removes them.
822
+ */
823
+ export declare function attachViewGestures(surface: HTMLElement, player: Pick<Player, "pan" | "zoom" | "canPan"> & PlaybackToggle, options?: ViewGestureOptions): () => void;
824
+ /**
825
+ * The keyboard shortcuts `<gyro-view>` answers, on `target`, which a page makes focusable: space
826
+ * or K play and pause, J and L seek, S stops, the arrows look around (with Shift they seek), plus
827
+ * and minus zoom, 0 resets the view, M mutes, F fills the screen and Escape leaves it. Returns
828
+ * what removes them.
829
+ */
830
+ export declare function attachKeyboard(target: HTMLElement, player: KeyboardHost["player"] & PlaybackToggle, options?: KeyboardOptions): () => void;
831
+ type HttpFetch = (url: string, init: RequestInit) => Promise<Response>;
832
+ interface HttpRequestOptions {
833
+ /**
834
+ * Extra request settings, for example credentials or headers. `Range` is set by the caller.
835
+ * Requests bypass the browser's HTTP cache unless these settings choose another `cache` mode.
836
+ */
837
+ readonly requestInit?: RequestInit;
838
+ readonly fetch?: HttpFetch;
839
+ }
840
+ export interface BrowserPortsOptions {
841
+ /**
842
+ * Shared by every request the player makes for the recording and its other lens file. A
843
+ * recording's own `credentials` and `fetch` (`UrlInput`) take the place of theirs.
844
+ */
845
+ readonly http?: HttpRequestOptions;
846
+ /**
847
+ * How long the decode probe may take before a lens is reported as timed out. Default 15 s,
848
+ * generous because hardware decoders wake slowly.
849
+ */
850
+ readonly probeTimeoutMs?: number;
851
+ }
852
+ /**
853
+ * A player composed for a browser: HTTP, blob and WebCodecs ports, the GPU pipeline and the
854
+ * device's attitude, drawing on the host's canvas and sounding through its audio element. What
855
+ * `<gyro-view>` plays with, and where a page that wants the player without the element starts.
856
+ */
857
+ export declare function createBrowserPlayer(host: PipelineHost, options?: BrowserPortsOptions): Player;
858
+ export interface InspectOptions extends Pick<BrowserPortsOptions, "http"> {
859
+ /**
860
+ * Abandons the requests for a URL; the inspection then rejects.
861
+ */
862
+ readonly signal?: AbortSignal;
863
+ }
864
+ /**
865
+ * Reads what a recording's file holds without playing it (see `RecordingInspection`): from a URL,
866
+ * in byte ranges as playback reads it, or from a `Blob`, such as a `File` from a picker. Rejects
867
+ * with the `GyroViewError` a load would meet, for example `cors` or `invalid-trailer`.
868
+ */
869
+ export declare function inspectRecording(recording: Blob | string, options?: InspectOptions): Promise<RecordingInspection>;
870
+ export interface RenditionOptions extends Pick<BrowserPortsOptions, "http"> {
871
+ /**
872
+ * How many pixels across the equirectangular picture is; half as many down. A multiple of
873
+ * four, so that both sides are even as encoders take them.
874
+ */
875
+ readonly width: number;
876
+ /**
877
+ * Where the rendition starts, in the recording's seconds; its start by default.
878
+ */
879
+ readonly from?: number;
880
+ /**
881
+ * Where it ends, not included; the recording's end by default, and at most.
882
+ */
883
+ readonly to?: number;
884
+ /**
885
+ * The player's own settings by default: its default stabilization, exposure matched along
886
+ * the seam, its default quality.
887
+ */
888
+ readonly stabilization?: StabilizationMode;
889
+ readonly gainMatching?: boolean;
890
+ readonly quality?: PictureQuality;
891
+ /**
892
+ * Where the picture is drawn; an `OffscreenCanvas` of the rendition's own if none.
893
+ */
894
+ readonly canvas?: HTMLCanvasElement | OffscreenCanvas;
895
+ /**
896
+ * Stops the opening, or the rendering, as `dispose` does.
897
+ */
898
+ readonly signal?: AbortSignal;
899
+ }
900
+ /**
901
+ * A recording rendered frame by frame into stitched, stabilized equirectangular pictures, for an
902
+ * encoder to take (ADR 0045). Unlike the player, it follows no clock: it draws every frame of the
903
+ * span exactly once, in order, when the consumer asks for the next, so a slow encoder loses
904
+ * nothing and a fast one waits only for the decoder. Works in a dedicated worker.
905
+ *
906
+ * @example
907
+ * ```ts
908
+ * const rendition = await openRendition({ main: { blob: file, name: file.name } }, { width: 3840 });
909
+ * for await (const frame of rendition.frames()) {
910
+ * await videoSource.add(new VideoSample(frame)); // a Mediabunny VideoSampleSource
911
+ * frame.close();
912
+ * }
913
+ * ```
914
+ */
915
+ export interface Rendition {
916
+ readonly metadata: PlayerMetadata;
917
+ readonly width: number;
918
+ readonly height: number;
919
+ /**
920
+ * Of the span rendered, in seconds.
921
+ */
922
+ readonly duration: number;
923
+ /**
924
+ * One `VideoFrame` per frame of the span, its timestamp in microseconds from the span's start,
925
+ * which the consumer closes. Iterated once; leaving the loop early stops the rendering.
926
+ */
927
+ frames(): AsyncGenerator<VideoFrame, void, undefined>;
928
+ /**
929
+ * Stops the rendering and lets go of the recording.
930
+ */
931
+ dispose(): void;
932
+ }
933
+ /**
934
+ * Opens a recording, as the player would, to render it frame by frame (see {@link Rendition}).
935
+ * Rejects with the `GyroViewError` a load would meet, and with `invalid-argument` for a width or
936
+ * span that holds no picture.
937
+ */
938
+ export declare function openRendition(source: PlayerSource, options: RenditionOptions): Promise<Rendition>;
939
+ /**
940
+ * Local files to play, from a picker or a drop.
941
+ */
942
+ export interface FileSource {
943
+ readonly main: File;
944
+ readonly second?: File;
945
+ }
946
+ interface LiveSettings {
947
+ stabilization: StabilizationMode;
948
+ viewMode: ViewMode;
949
+ quality: PictureQuality;
950
+ fov: number;
951
+ yaw: number;
952
+ pitch: number;
953
+ muted: boolean;
954
+ loop: boolean;
955
+ volume: number;
956
+ }
957
+ /**
958
+ * The events `<gyro-view>` dispatches: each player event as a `CustomEvent` of the same name,
959
+ * its payload in `detail`. They take the place of the element events some share a name with
960
+ * (`play`, `pause`, `error`...), which a custom element never fires itself.
961
+ */
962
+ export type GyroViewElementEventMap = Omit<HTMLElementEventMap, keyof PlayerEvents> & {
963
+ readonly [Name in keyof PlayerEvents]: CustomEvent<PlayerEvents[Name]>;
964
+ };
965
+ declare const ElementBase: typeof HTMLElement;
966
+ declare class TypedEventElement extends ElementBase {
967
+ addEventListener<Name extends keyof GyroViewElementEventMap>(type: Name, listener: (this: this, event: GyroViewElementEventMap[Name]) => unknown, options?: boolean | AddEventListenerOptions): void;
968
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
969
+ removeEventListener<Name extends keyof GyroViewElementEventMap>(type: Name, listener: (this: this, event: GyroViewElementEventMap[Name]) => unknown, options?: boolean | EventListenerOptions): void;
970
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
971
+ }
972
+ /**
973
+ * `<gyro-view>`: the player as an element. Attributes name what to play and configure the
974
+ * settings; the settings' properties report what is in effect now, as a media element's `muted`
975
+ * does; the player's events are dispatched as `CustomEvent`s of the same name with the payload
976
+ * in `detail`. Facade over {@link Player}, the controls and the gestures (ADR 0016).
977
+ */
978
+ export declare class GyroViewElement extends TypedEventElement implements LiveSettings {
979
+ static readonly observedAttributes: readonly string[];
980
+ src: string | null;
981
+ src2: string | null;
982
+ poster: string | null;
983
+ crossOrigin: "anonymous" | "use-credentials" | null;
984
+ preload: "none" | "auto";
985
+ gainMatch: "on" | "off";
986
+ autoplay: boolean;
987
+ controls: boolean;
988
+ stabilization: StabilizationMode;
989
+ viewMode: ViewMode;
990
+ quality: PictureQuality;
991
+ fov: number;
992
+ yaw: number;
993
+ pitch: number;
994
+ muted: boolean;
995
+ loop: boolean;
996
+ volume: number;
997
+ /**
998
+ * How the recording's requests are sent: `null`, the default, for the platform's `fetch`, or a
999
+ * page's function in its place (`RecordingFetch`), to add a header such as `Authorization` or
1000
+ * to sign each request. Set from script only; there is no attribute. Like `crossorigin`, a
1001
+ * change loads a recording named by URL again, and local files play on; the same function set
1002
+ * again changes nothing, so a framework may set it on every render. A function that reads its
1003
+ * token afresh for each request goes on playing when the token is renewed.
1004
+ */
1005
+ fetch: RecordingFetch | null;
1006
+ /**
1007
+ * Properties the page set before the element was defined, kept until it is connected.
1008
+ */
1009
+ private readonly earlyProperties;
1010
+ private readonly player;
1011
+ private readonly loads;
1012
+ private readonly wording;
1013
+ private readonly controlsBar;
1014
+ private readonly fullscreen;
1015
+ private readonly idle;
1016
+ private readonly posterImage;
1017
+ private readonly canvas;
1018
+ private gestures;
1019
+ constructor();
1020
+ /**
1021
+ * Where the player is: `idle` or `loading`, then the loaded recording's playback state.
1022
+ */
1023
+ get status(): PlayerStatus;
1024
+ /**
1025
+ * What the player learned about the loaded recording; undefined until it is ready.
1026
+ */
1027
+ get metadata(): PlayerMetadata | undefined;
1028
+ /**
1029
+ * The media time shown, in seconds; setting it seeks there exactly.
1030
+ */
1031
+ get currentTime(): number;
1032
+ set currentTime(time: number);
1033
+ /**
1034
+ * The loaded recording's length in seconds; 0 without one.
1035
+ */
1036
+ get duration(): number;
1037
+ /**
1038
+ * True unless playback is under way or waiting for data to go on, as a media element's.
1039
+ */
1040
+ get paused(): boolean;
1041
+ /**
1042
+ * Where the normal view looks: yaw and pitch in degrees, and the horizontal field of view.
1043
+ */
1044
+ get view(): ViewAngles;
1045
+ /**
1046
+ * Whether turning the device turns the normal view: `on`, `off`, or `unavailable` where the
1047
+ * device reports no attitude or access was refused.
1048
+ */
1049
+ get motionLook(): MotionLookState;
1050
+ /**
1051
+ * Every word the element shows or says to assistive technology. Setting it replaces any of
1052
+ * them, table by table (`labels`, `stabilizationModes`, `viewModes`, `errors`); the others keep
1053
+ * their English defaults, and `null` brings them all back.
1054
+ */
1055
+ get messages(): GyroViewMessages;
1056
+ set messages(overrides: GyroViewMessageOverrides | null | undefined);
1057
+ connectedCallback(): void;
1058
+ disconnectedCallback(): void;
1059
+ attributeChangedCallback(name: string, _previous: string | null, value: string | null): void;
1060
+ /**
1061
+ * Starts playing, waiting for a load in progress, one the attributes set just now asked for,
1062
+ * or, out of the document, the connection; resolves once playback runs. Rejects when the
1063
+ * browser refuses to start, with `no-source` without a recording, and with `play-interrupted`
1064
+ * when the element left the document or its recording was replaced first.
1065
+ */
1066
+ play(): Promise<void>;
1067
+ /**
1068
+ * Pauses, keeping the frame on screen.
1069
+ */
1070
+ pause(): void;
1071
+ /**
1072
+ * Pauses and goes back to the start.
1073
+ */
1074
+ stop(): void;
1075
+ /**
1076
+ * Seeks exactly to `time` seconds; right after a new `src`, the new recording starts there.
1077
+ */
1078
+ seek(time: number): void;
1079
+ /**
1080
+ * Seeks to the key frame at or before `time`: quick to show while a seek bar is dragged.
1081
+ */
1082
+ scrub(time: number): Promise<void>;
1083
+ /**
1084
+ * Points the normal view at `yaw` and `pitch`, in degrees: yaw positive to the right, pitch
1085
+ * positive up.
1086
+ */
1087
+ lookAt(yaw: number, pitch: number): void;
1088
+ /**
1089
+ * Brings the current view mode back to how it starts, the others keeping their framing.
1090
+ */
1091
+ resetView(): void;
1092
+ /**
1093
+ * Zooms by `steps` (positive zooms in, each step by a factor of 1.1, within each view mode's
1094
+ * limits) toward `focus`, a point of the picture as fractions of its size; about the centre
1095
+ * when none is given.
1096
+ */
1097
+ zoom(steps: number, focus?: ScreenPoint): void;
1098
+ /**
1099
+ * Lets the device turn the normal view, as a window into the recording. Call it from a tap's
1100
+ * handler: iOS asks the viewer for access there and refuses it anywhere else. Resolves with the
1101
+ * state it ends in (`motionLook`); a refusal is a `warning`, never a rejection.
1102
+ */
1103
+ startMotionLook(): Promise<MotionLookState>;
1104
+ /**
1105
+ * Gives the view back to the pointer, level, looking where it looked.
1106
+ */
1107
+ stopMotionLook(): void;
1108
+ /**
1109
+ * Stabilizes the picture in `mode` (`off`, `lock`, `horizon`, `follow`); any other value,
1110
+ * an unset one included, is refused.
1111
+ */
1112
+ setStabilization(mode: StabilizationMode): void;
1113
+ /**
1114
+ * Shows the picture in `mode` (`raw-lenses`, `equirectangular`, `normal`); any other value,
1115
+ * an unset one included, is refused.
1116
+ */
1117
+ setViewMode(mode: ViewMode): void;
1118
+ /**
1119
+ * Reads the lens images as `quality` says (`fast`, `balanced`, `high`); any other value, an
1120
+ * unset one included, is refused.
1121
+ */
1122
+ setQuality(quality: PictureQuality): void;
1123
+ /**
1124
+ * Fills the screen with the player, through the Fullscreen API or pinned over the page, or
1125
+ * leaves it.
1126
+ */
1127
+ toggleFullscreen(): Promise<void>;
1128
+ /**
1129
+ * Loads what the attributes (or the files handed in) name: the change already waiting to be
1130
+ * read, or else now; out of the document, once connected. Resolves once the recording is
1131
+ * ready; rejects with the failure, which is dispatched as an `error` event too.
1132
+ */
1133
+ load(): Promise<void>;
1134
+ /**
1135
+ * Plays local files instead of the `src` attributes, until `src` or `src2` change.
1136
+ */
1137
+ loadFiles(files: FileSource): void;
1138
+ /**
1139
+ * A move within the document disconnects and connects again at once: only an element still out
1140
+ * of it a microtask later was removed. It lets its recording go, and leaves the pinned fill as
1141
+ * the browser's fullscreen element leaves fullscreen.
1142
+ */
1143
+ private leaveIfRemoved;
1144
+ /**
1145
+ * The canvas is read at each load, since a fresh one replaces one whose context is gone.
1146
+ */
1147
+ private pipelineHost;
1148
+ private readonly onCanvasReplaced;
1149
+ /**
1150
+ * What the controls and the keyboard ask of the element. They live as long as the element:
1151
+ * their listeners sit on its own shadow tree and host, and on its player.
1152
+ */
1153
+ private controlsHost;
1154
+ /**
1155
+ * A tap on the picture toggles playback, except a touch that brought hidden controls back:
1156
+ * touch has no hover to reveal them, so that tap is the viewer asking to see them. Without
1157
+ * controls there is nothing to reveal, and every tap toggles.
1158
+ */
1159
+ private readonly onPictureTap;
1160
+ private readonly togglePlayback;
1161
+ /**
1162
+ * Queued, as a media element queues its events: an attribute in the markup is read as the
1163
+ * element is defined, and a property before it, both before a page's script after the
1164
+ * definition adds its listener.
1165
+ */
1166
+ private readonly warn;
1167
+ }
1168
+ /**
1169
+ * The attributes `<gyro-view>` takes, for a framework's JSX declaration of the element (React,
1170
+ * Preact, Solid): each is optional, a number may be given as text, and a boolean attribute is
1171
+ * set by `true`.
1172
+ */
1173
+ export interface GyroViewAttributes {
1174
+ readonly src?: string | undefined;
1175
+ readonly src2?: string | undefined;
1176
+ readonly crossorigin?: "anonymous" | "use-credentials" | "" | undefined;
1177
+ readonly poster?: string | undefined;
1178
+ readonly preload?: "none" | "auto" | undefined;
1179
+ readonly "gain-match"?: "on" | "off" | undefined;
1180
+ readonly autoplay?: boolean | undefined;
1181
+ readonly muted?: boolean | undefined;
1182
+ readonly loop?: boolean | undefined;
1183
+ readonly controls?: boolean | undefined;
1184
+ readonly stabilization?: StabilizationMode | undefined;
1185
+ readonly "view-mode"?: ViewMode | undefined;
1186
+ readonly quality?: PictureQuality | undefined;
1187
+ readonly fov?: number | string | undefined;
1188
+ readonly yaw?: number | string | undefined;
1189
+ readonly pitch?: number | string | undefined;
1190
+ }
1191
+ export declare const GYRO_VIEW_TAG = "gyro-view";
1192
+ declare global {
1193
+ interface HTMLElementTagNameMap {
1194
+ [GYRO_VIEW_TAG]: GyroViewElement;
1195
+ }
1196
+ }
1197
+ /**
1198
+ * Registers `<gyro-view>` once. A page that loads the package twice keeps the first definition,
1199
+ * and hears once that another copy was there first, which may be another version. Without a
1200
+ * custom element registry (a server rendering the page) there is nothing to register.
1201
+ */
1202
+ export declare function defineGyroView(): void;
1203
+
1204
+ export {};