textTracks method
Implementation
Future<List<dynamic>> textTracks() {
return webViewController.runJavaScriptReturningResult('''
(function() {
var textTracks = player.textTracks();
var arrayList = [];
Array.from(textTracks).forEach(function(track) {
if (track.kind === 'subtitles' || track.kind === 'captions') {
var trackObj = {
default: track.default || false,
id: track.id || '',
kind: track.kind,
label: track.label,
language: track.language,
mode: track.mode
};
arrayList.push(trackObj);
}
});
return JSON.stringify(arrayList);
})();
''').then((v) {
return jsonDecode(v.toString());
});
}