videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
37.91k stars 7.43k forks source link

loadTrack throws a TypeError on latest vtt.js #3820

Open benjaoming opened 7 years ago

benjaoming commented 7 years ago

Description

This problem affects loading of VTT subtitles and is necessary to fix for future releases of vtt.js which have to be implemented for video-js VTT subtitles to work with Firefox 50 as detailed in videojs/video.js#3819

Using the latest vtt.js master branch produces a type error after XHR calls.

Thanks to @bzbarsky for finding the solution, which is to add responseType: "arraybuffer" to default xhr2 options.

Making a PR for further discussion.

Steps to reproduce

We have details over in the below issue, otherwise I think the way to reproduce is to simply replace vtt.js 0.12.x with the latest master.

https://github.com/learningequality/ka-lite/issues/5347

Error output

Example from our custom built:

TypeError: Argument 1 of TextDecoder.decode could not be converted to any of: ArrayBufferView, ArrayBuffer

    require<[756]</</WebVTT.Parser.prototype.parse http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:1961:24
    parseCues http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:11121:3
    loadTrack/< http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:11177:7
    ret http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:21958:12
    once/< http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:11681:12
    loadFunc http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:11555:9
    readystatechange http://127.0.0.1:8000/static/js/distributed/bundles/bundle_video.js:11485:13

Additional Information

versions

videojs

Any version that bumps vtt.js to latest master AFAIK.

browsers

Any

OSes

Any

gkatsev commented 7 years ago

We need update our copy of vttjs from upstream and this issue would need to be addressed at that point.