Skip to content

Commit

Permalink
Add simple 'loading' indicator for motion study video
Browse files Browse the repository at this point in the history
  • Loading branch information
hobinjk-ptc committed Nov 1, 2024
1 parent 459e716 commit 28185e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,11 @@ Logic Interface CSS
cursor: pointer;

pointer-events: all;
}

.analytics-video-toggle.analytics-video-toggle-loading {
color: #777;
cursor: progress;
}

.analytics-export-link-container {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/ar/videoPlayback.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class VideoPlayer extends Followable {
// this.phone.add(this.debugBox);

this.rvl = null;
fetch(urls.rvl).then(res => {
this.rvlLoadPromise = fetch(urls.rvl).then(res => {
return res.arrayBuffer();
}).then(buf => {
this.rvl = new RVLParser(buf);
Expand Down
17 changes: 15 additions & 2 deletions src/motionStudy/motionStudy.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,20 @@ export class MotionStudy {

createVideoPlayerShowHideButton() {
this.videoPlayerShowHideButton = document.createElement('div');
this.videoPlayerShowHideButton.classList.add('analytics-video-toggle');
this.videoPlayerShowHideButton.classList.add('analytics-video-toggle', 'analytics-video-toggle-loading');
this.videoPlayerShowHideButton.classList.add('analytics-button-container');
this.videoPlayerShowHideButton.textContent = 'Show Spatial Video';
this.videoPlayerShowHideButton.textContent = 'Loading Spatial Video';

this.videoPlayer.rvlLoadPromise.then(() => {
this.videoPlayerShowHideButton.textContent = 'Show Spatial Video';
this.videoPlayerShowHideButton.classList.remove('analytics-video-toggle-loading');
});

this.videoPlayerShowHideButton.addEventListener('pointerup', () => {
if (this.videoPlayerShowHideButton.classList.contains('analytics-video-toggle-loading')) {
return;
}

if (this.videoPlayer.isShown()) {
this.humanPoseAnalyzer.setDepthTestEnabled(true);
this.videoPlayer.hide();
Expand All @@ -811,6 +821,9 @@ export class MotionStudy {
if (!this.videoPlayerShowHideButton || !this.videoPlayer) {
return;
}
if (this.videoPlayerShowHideButton.classList.contains('analytics-video-toggle-loading')) {
return;
}

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

0 comments on commit 28185e4

Please sign in to comment.