Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deboer-tim
Copy link
Collaborator

Fixes three things:

  1. Move the existing utility functions out of DiskContestSource to create a reusable mime type utility class, to avoid some of the duplication and differences in behaviour.

  2. The mime type wasn't being set when downloading reaction videos - but using the new util fixes this.

  3. When we started supporting MPEG-TS there was conflicting information about the correct file extension and mime type, and based on google AI and video.js we got it wrong:

   MPEG Transport Stream (MPEG 2 transport stream) <-- this is what we actually support
   File extension: .ts
   Mime type: video/mp2t
   188-byte packets

   MPEG-2 Transport Stream <-- variant used by Blu-ray & AVCHD disks
   File extension: .m2ts
   Mime type: video/m2ts
   192-byte packets (4 bytes added to help file seeking)

This switches us to use the file extension and mime type of the first.

Fixes three things:

1. Move the existing utility functions out of DiskContestSource to create a reusable
   mime type utility class, to avoid some of the duplication and differences in
   behaviour.

2. The mime type wasn't being set when downloading reaction videos - but using the
   new util fixes this.

3. When we started supporting MPEG-TS there was conflicting information about the
   correct file extension and mime type, and based on google AI and video.js we got
   it wrong:

   MPEG Transport Stream (MPEG 2 transport stream) <-- this is what we actually support
   File extension: .ts
   Mime type: video/mp2t
   188-byte packets

   MPEG-2 Transport Stream <-- variant used by Blu-ray & AVCHD disks
   File extension: .m2ts
   Mime type: video/m2ts
   192-byte packets (4 bytes added to help file seeking)

   This switches us to use the file extension and mime type of the first.
@nickygerritsen
Copy link
Collaborator

@deboer-tim
Copy link
Collaborator Author

This also means we can drop icpctools/team-view@main/src/lib/ui/Video.svelte#L45-L48

Yeah. I figured it doesn't hurt anything so leave it in for a bit in case someone has an older CDS, then eventually remove.

@deboer-tim deboer-tim merged commit 67ca418 into icpctools:main Sep 30, 2025
4 checks passed
@deboer-tim deboer-tim deleted the mime-video branch September 30, 2025 20:59
deboer-tim added a commit to deboer-tim/icpctools that referenced this pull request Oct 1, 2025
We record webcam and desktop for reactions videos, but there is only one reaction
property, so we've been serving desktop as one file and webcam as another, i.e.:

{"id":"2",... "reaction":[{"href":"contests/baku-live/submissions/2/reaction-webcam","filename":"reaction-webcam.m2ts","mime":"video/m2ts"},{"href":"contests/baku-live/submissions/2/reaction-desktop","filename":"reaction-desktop.m2ts","mime":"video/m2ts"}]}

The only way you could tell these part was based on the filename or url - but now the spec
has tags, which are a much better way to differentiate them.

This PR makes two changes: renaming the files to use '.' instead of '-' to match the variant
format in the draft spec, and adding support for these tags. The new output looks like:

{"id":"2",... "reaction":[{"href":"contests/baku-live/submissions/2/reaction.webcam","filename":"reaction.webcam.ts","mime":"video/mp2t","tags":["webcam"]},{"href":"contests/baku-live/submissions/2/reaction.desktop","filename":"reaction.desktop.ts","mime":"video/mp2t","tags":["desktop"]}]}

(file extension and mimetype already changed via PR icpctools#1236)
deboer-tim added a commit that referenced this pull request Oct 1, 2025
We record webcam and desktop for reactions videos, but there is only one reaction
property, so we've been serving desktop as one file and webcam as another, i.e.:

{"id":"2",... "reaction":[{"href":"contests/baku-live/submissions/2/reaction-webcam","filename":"reaction-webcam.m2ts","mime":"video/m2ts"},{"href":"contests/baku-live/submissions/2/reaction-desktop","filename":"reaction-desktop.m2ts","mime":"video/m2ts"}]}

The only way you could tell these part was based on the filename or url - but now the spec
has tags, which are a much better way to differentiate them.

This PR makes two changes: renaming the files to use '.' instead of '-' to match the variant
format in the draft spec, and adding support for these tags. The new output looks like:

{"id":"2",... "reaction":[{"href":"contests/baku-live/submissions/2/reaction.webcam","filename":"reaction.webcam.ts","mime":"video/mp2t","tags":["webcam"]},{"href":"contests/baku-live/submissions/2/reaction.desktop","filename":"reaction.desktop.ts","mime":"video/mp2t","tags":["desktop"]}]}

(file extension and mimetype already changed via PR #1236)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants