Sudhir Ranjan Rout
User
Nov 29, 2016 05:50AM EST
0
rated :
Hi Donni,Here is the updated code. if i set null to the variable which i passed to check the url then cc button not loaded. but the problem is after value return from ajax call then by default it sets value to its' original mode. <script type ="text/javascript"> var urlToFileVTT = 'jwplayer-7.2.2/MUNAA.vtt'; // var urlToFileXML = 'jwplayer-7.2.2/MU11NA.xml'; var myJwPlayer = jwplayer("myElement").setup({ playlist: [{ file: "jwplayer-7.2.2/MUNA.mp4", image:"images.jpg", titile: "My file", displaytitle: true, startparam: 'start', modes: [ // {type: 'flash', src: 'jwplayer/player.swf'}, {type: 'flash'} ], tracks: [{ file: urlToFileVTT, label: "English", kind: "captions", "default": false }] }], "playlist.position": "right","playlist.size": 360,height: 270,width: 72, captions: { color: '#FF33F9', fontSize: 24, backgroundOpacity: 20 } }); console.log(myJwPlayer); console.log(myJwPlayer.getRenderingMode()); myJwPlayer.onPlay(function(e) { doesFileExist(urlToFileVTT); // doesFileExist(urlToFileXML); alert("Volume is changed to: "+ e.play()); }); function doesFileExist(urlToFileVTT) { var xhr = new XMLHttpRequest(); xhr.open('HEAD',urlToFileVTT,false); xhr.send(); if (xhr.status == "404") { alert("File is not found"); urlToFileVTT = null; console.log("File not exist"+urlToFileVTT); return false; } else { alert("File is"); console.log("File exists"); alert(xhr.getAllResponseHeaders()); return true; } } this is the updated code and the problem is if value which is returned from ajax call if i am able to set then my problem will be solved. so please see this code and give me a perfect solution.