fix safari cannot play ts file problem. #188
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug:
MacOS safari can't play TS file.
steps to reproduce
https://github.com/xqq/mpegts.js
, and build the project, (check the README).npm install; npm install -g webpack-cli; npm run build
;npm run serve
;http://localhost:8080/arib.html
in safari;test.ts
file with audio codec asopus
;e.g. by ffmpeg:
ffmpeg -i [file].[aac|opus] -acodec opus test.ts
test.ts
,e.g. by this python script:
https://gist.github.com/mkows/cd2122f427ea722bf41aa169ef762001
python server-cors.py 9921
http://localhost:8080/arib.html
, input Stream URL as:http://127.0.0.1:9921/test.ts
, deselectisLive
&withCredentials
&liveSync
checkbox. then clickLoad
button.opus
audio can not play in safari.Root Cause
the Safari web browser don't support MIME
audio/mp4;codecs=opus
, but supportaudio/mp4;codecs=Opus
.In side safari web dev tools, go to
Console
tab. InputMediaSource.isTypeSupported('audio/mp4;codecs=opus')
andMediaSource.isTypeSupported('audio/mp4;codecs=Opus')
to verify.