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

MIME type checks should ignore case #1991

Closed
petar11199 opened this issue Jun 12, 2019 · 5 comments
Closed

MIME type checks should ignore case #1991

petar11199 opened this issue Jun 12, 2019 · 5 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@petar11199
Copy link

Have you read the FAQ and checked for duplicate open issues?
Yes

What version of Shaka Player are you using?
2.5.0

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from master?
Yes

Are you using the demo app or your own custom app?
Custom

If custom app, can you reproduce the issue using our demo app?
Yes

What browser and OS are you using?
Google Chrome 74, Windows 10

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

What did you do?

Load HLS stream

What did you expect to happen?
I expected Shaka player to correctly read media type video/MP2T and play the stream.

What actually happened?

Shaka throw 4032 error CONTENT_UNSUPPORTED_BY_BROWSER

This is caused because of the wrong media type case in Shaka player.

As by MDN (author Damjan Bursac), extension .ts should have MIME Type video/MP2T and not video/mp2t which is currently set in Shaka player.

This is mandatory by W3.org and RFC internet standard.

I have submitted a pull request with changes.

Thanks.
Petar Marjanovic

@chrisfillmore
Copy link
Contributor

chrisfillmore commented Jun 12, 2019

I didn't read the whole spec but it's not clear to me that it mandates that the characters must be uppercase. It says the mimeType "must be used" but not that it must be used exactly. I think this is a case where it would be safe to ignore case, and just call toLowerCase() after parsing. This may be friendlier to other providers who use video/mp2t.

@petar11199
Copy link
Author

petar11199 commented Jun 12, 2019

@chrisfillmore Every article or spec I found is written with uppercase, also on W3 it clearly says "must be used". But I agree that it may interfere with others and that toLoweCase() should be a better idea. I will update my pull request with those changes.

@joeyparrish joeyparrish added status: working as intended The behavior is intended; this is not a bug and removed needs triage labels Jun 12, 2019
@joeyparrish
Copy link
Member

@petar11199, the RFC for MIME types states that this part is case insensitive. In RFC 2045, section 5.1 ("Syntax of the Content-Type Header Field"), it states:

The type, subtype, and parameter names are not case sensitive. For example, TEXT, Text, and TeXt are all equivalent top-level media types.

The MDN article you referenced is merely a wiki, not an authoritative document. (And I've just updated it.) The RFC you linked to is about RTP, where the name of the encoding may well be uppercase, but that does not mean that the MIME type is mandated to be.

It's worth noting that you're getting this error on Chrome, which does not actually support MPEG2-TS natively. Support for that in Shaka Player comes through transmuxing, and we have to identify TS content accordingly before querying the browser's supported formats. As you and Chris have determined, it seems that we are doing an exact string match for video/mp2t, where we should be ignoring the case.

So yes, please update your PR so that the HLS parser, transmuxer, and MSE polyfill all use toLowerCase(). I think the rest of the instances you found can stay as they are, since they are not comparing against input. Thank you for bringing this to our attention, and thank you for contributing!

@joeyparrish joeyparrish changed the title Wrong mime type case MIME type checks should ignore case Jun 12, 2019
@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed status: working as intended The behavior is intended; this is not a bug labels Jun 12, 2019
@shaka-bot shaka-bot added this to the v2.6 milestone Jun 12, 2019
@theodab theodab assigned theodab and unassigned theodab Jun 12, 2019
@petar11199
Copy link
Author

@joeyparrish Thank you for your detailed explanation about this issue. I looked at our competitors streaming players and found out that they were using uppercase so I began to investigate, and finally got here. As of error on Chrome, I am aware that MPEG2-TS is not supported, but I didn't manage to fix it using mux.js for some unknown reason, so I had to look somewhere else.

I will update PR with needed changes as soon as I can.
Thank you again for your time,
Petar

@joeyparrish
Copy link
Member

I'll have a fix for this soon, so I'm closing the PR. Thanks!

@joeyparrish joeyparrish self-assigned this Jul 9, 2019
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Closes shaka-project#1991

Change-Id: Ib76f7539ff5173fca1ddb409e33240e7e9d3fd11
TheModMaker pushed a commit that referenced this issue Jul 19, 2019
Closes #1991

Change-Id: Ib76f7539ff5173fca1ddb409e33240e7e9d3fd11
@shaka-project shaka-project locked and limited conversation to collaborators Sep 7, 2019
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants