Orange-OpenSource / hasplayer.js

Http Adaptive Streaming javascript player based on HTML5 premium extensions (MSE/EME)
Other
198 stars 67 forks source link

Detect PlayReady messages encoding #207

Closed onotole closed 6 years ago

bbert commented 6 years ago

Hi, I am not sure the way you detect encoding is robust. There is already a method that is implemented in the project for detecting character encoding, used by https://github.com/Orange-OpenSource/hasplayer.js/blob/development/app/js/streaming/captioning/TextTTMLXMLMP4SourceBuffer.js. May be we could use the same method if suitable. Then move it to utils folder and use it.

onotole commented 6 years ago

Hi bbert, I like your idea with for more generic utf-16 detection. Alternatively, to take in account possible BOM or Endianness, we could just check 4 first byte and deduct utf-16 if one of the bytes is zero. This would be totally robust for distinguishing utf-8 from utf-16 for xml data.

bbert commented 6 years ago

Hi @onotole, Could you update this PR according to what we discussed? Can you propose your method to detect UTF-16 and move it to utils folder?

bbert commented 6 years ago

Hi, I have picked up isUTF16() function implemented in TextTTMLXMLMP4SourceBuffer as a utility function, and then use it for PlayReady message format detection. Let me know if it is ok for you, so that I can merge.

jeffcunat commented 6 years ago

verified with Orange VOD with subtitles on Edge and IE 11