mapbox / mapbox/mapbox-gl-js

Video source repaint after seeked

Open
#7,647 2 comments 0 reactions 0 assignees View on GitHub
feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

## Motivation

I need the ability to set or update the currentTime of a video in mapbox-gl while the video is paused. As the video source is written now the video source is only painted while the video is playing, so after pausing and changing the time, no visible change is seen in mapbox-gl.

## Design Alternatives

You could add another event listener to the video for the "seeked" event and when that event fires, set a flag to repaint the video which is then removed after being painted once.

## Design

Potential issues: The hasTransition() and prepare() functions might not always execute in the correct order due to a race condition, one additional flag may be needed to ensure that prepare() is run first, then hasTransition()

### Mock-Up

Potential solution, see patch attached to this request or the demo [here](https://dwilson2547.github.io/mapbox-video-controls-example/index.html)

### Concepts

This shouldn't affect the existing functionality of the video source, I'm hoping to add to it in such a way that no one has to modify existing code using the video source.

### Implementation

[videofix.txt](https://github.com/mapbox/mapbox-gl-js/files/2631392/videofix.txt)

Contributor guide

Open the contributing guide

Research direction

Review the attached videofix.txt and the video source implementation, then reproduce the paused-video seek case using the linked demo. Trace how video playback triggers repainting and determine where the seeked event fits with prepare() and hasTransition(). Done means changing currentTime while paused visibly updates the map without changing existing video-source behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.