From eb967c872f895990eef5d2c158cae091bb59c54c Mon Sep 17 00:00:00 2001 From: Will Kelleher Date: Fri, 7 Apr 2017 10:50:53 -0500 Subject: [PATCH] Fix caption integration --- src/videojs5.hlsjs.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/videojs5.hlsjs.js b/src/videojs5.hlsjs.js index e10dd55..036dc7a 100644 --- a/src/videojs5.hlsjs.js +++ b/src/videojs5.hlsjs.js @@ -101,6 +101,18 @@ }); }); + // Intercept native TextTrack calls and route to video.js directly only + // if native text tracks are not supported on this browser. + if (!tech.featuresNativeTextTracks) { + Object.defineProperty(el, 'textTracks', { + value: tech.textTracks, + writable: false + }); + el.addTextTrack = function() { + return tech.addTextTrack(arguments); + } + } + // attach hlsjs to videotag hls.attachMedia(el); hls.loadSource(source.src);