Improve Recordings loading (#10462)

* Show skeleton until video players finishes loading

* Clean up android logic

* Ensure mobile view video is consistent

* Cleanup

* Only show when not scrubbing

* Don't use loading

* Start preview at correct time too

* Fix react race condition

* Be wait for seek to show video player
This commit is contained in:
Nicolas Mowen
2024-03-15 07:52:38 -05:00
committed by GitHub
parent d882cb0f63
commit c66f552280
5 changed files with 63 additions and 18 deletions
+13 -14
View File
@@ -272,26 +272,25 @@ class PreviewVideoController extends PreviewController {
}
if (this.timeToSeek) {
if (
Math.round(this.previewRef.current.currentTime + this.preview.start) !=
Math.round(this.timeToSeek)
) {
if (isAndroid) {
const currentTs =
this.previewRef.current.currentTime + this.preview.start;
const diff = this.timeToSeek - currentTs;
const diff =
Math.round(this.timeToSeek) -
Math.round(this.previewRef.current.currentTime + this.preview.start);
if (Math.abs(diff) > 1) {
let seekTime;
if (isAndroid) {
if (diff < 30) {
this.previewRef.current.currentTime =
this.previewRef.current.currentTime + diff / 2;
seekTime = Math.round(
this.previewRef.current.currentTime + diff / 2,
);
} else {
this.previewRef.current.currentTime =
this.timeToSeek - this.preview.start;
seekTime = Math.round(this.timeToSeek - this.preview.start);
}
} else {
this.previewRef.current.currentTime =
this.timeToSeek - this.preview.start;
seekTime = this.timeToSeek - this.preview.start;
}
this.previewRef.current.currentTime = seekTime;
} else {
this.seeking = false;
this.timeToSeek = undefined;