Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resumable media uploads #31820

Open
graue opened this issue Sep 9, 2024 · 0 comments
Open

Resumable media uploads #31820

graue opened this issue Sep 9, 2024 · 0 comments
Labels
suggestion Feature suggestion

Comments

@graue
Copy link

graue commented Sep 9, 2024

Pitch

When I'm out and about using mobile data, I find it hard to successfully upload photos and videos to Mastodon, because the uploads fail before they complete. I waste time and battery trying to upload again and again, only for the upload to drop each time — sometimes when it was almost finished!

Mastodon should have an API that allows resuming uploads. The current API does not allow this, requiring media to be uploaded all in one single request, which is difficult to achieve on even the best mobile connections when videos up to 99 MB are supported!

There is (surprisingly) no protocol-level standard on resumable uploads yet, but there is a standards-track draft called Resumable Uploads For HTTP, or RUFH. Alternatively, Mastodon could implement an ad-hoc API, which is what most makers of social/messaging apps seem to have done. Either way it would need the same basic parts as the standards draft has, something like:

  • POST /api/v3/media: reserve space for a media file to be uploaded and respond with a URL or ID (while possibly only uploading a small initial chunk of the file, or nothing),
  • HEAD /api/v3/media/:id: check how much of a media file has been successfully uploaded so far,
  • PATCH /api/v3/media/:id: upload an additional chunk of the media file, with a header or parameter giving the intended offset into the file (with a 409 Conflict given if that offset doesn't match the bytes uploaded so far).

and optionally DELETE /api/v3/media/:id to cancel a media upload. But Mastodon could cover this by just deleting orphaned media periodically. I guess it already does that if the media are not attached to a status.

Motivation

Being able to resume an upload will make it a lot easier for people to share photos and videos from events happening in the real world. Even I struggle with this living in a large North American city, so I can only imagine how crucial more reliable uploading of media may be for people in rural areas and in the Global South.

@graue graue added the suggestion Feature suggestion label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Feature suggestion
Projects
None yet
Development

No branches or pull requests

1 participant