Skip to content

Commit fc558b0

Browse files
committed
Add simple 'loading' indicator for motion study video
1 parent e0e9291 commit fc558b0

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

css/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,11 @@ Logic Interface CSS
21102110
cursor: pointer;
21112111

21122112
pointer-events: all;
2113+
}
21132114

2115+
.analytics-video-toggle.analytics-video-toggle-loading {
2116+
color: #777;
2117+
cursor: progress;
21142118
}
21152119

21162120
.analytics-export-link-container {

src/gui/ar/videoPlayback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class VideoPlayer extends Followable {
180180
// this.phone.add(this.debugBox);
181181

182182
this.rvl = null;
183-
fetch(urls.rvl).then(res => {
183+
this.rvlLoadPromise = fetch(urls.rvl).then(res => {
184184
return res.arrayBuffer();
185185
}).then(buf => {
186186
this.rvl = new RVLParser(buf);

src/motionStudy/motionStudy.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,10 +791,20 @@ export class MotionStudy {
791791

792792
createVideoPlayerShowHideButton() {
793793
this.videoPlayerShowHideButton = document.createElement('div');
794-
this.videoPlayerShowHideButton.classList.add('analytics-video-toggle');
794+
this.videoPlayerShowHideButton.classList.add('analytics-video-toggle', 'analytics-video-toggle-loading');
795795
this.videoPlayerShowHideButton.classList.add('analytics-button-container');
796-
this.videoPlayerShowHideButton.textContent = 'Show Spatial Video';
796+
this.videoPlayerShowHideButton.textContent = 'Loading Spatial Video';
797+
798+
this.videoPlayer.rvlLoadPromise.then(() => {
799+
this.videoPlayerShowHideButton.textContent = 'Show Spatial Video';
800+
this.videoPlayerShowHideButton.classList.remove('analytics-video-toggle-loading');
801+
});
802+
797803
this.videoPlayerShowHideButton.addEventListener('pointerup', () => {
804+
if (this.videoPlayerShowHideButton.classList.contains('analytics-video-toggle-loading')) {
805+
return;
806+
}
807+
798808
if (this.videoPlayer.isShown()) {
799809
this.humanPoseAnalyzer.setDepthTestEnabled(true);
800810
this.videoPlayer.hide();
@@ -811,6 +821,9 @@ export class MotionStudy {
811821
if (!this.videoPlayerShowHideButton || !this.videoPlayer) {
812822
return;
813823
}
824+
if (this.videoPlayerShowHideButton.classList.contains('analytics-video-toggle-loading')) {
825+
return;
826+
}
814827

815828
if (this.videoPlayer.isShown()) {
816829
this.videoPlayerShowHideButton.textContent = 'Hide Spatial Video';

0 commit comments

Comments
 (0)