javascript - Samsung TV APP - Update scenes content on network reconnection -


the issue face has loading , reloading of scenes content. app works today not respond network disconnection , reconnection.

for example ,there states ajax-state 200 / fine .. data coming in null -> leads empty scenes.

here snippet controller looks :

controller.assignevents = function() {     var player = document.getelementbyid('pluginobjectplayer');     player.onconnectionfailed = 'controller.connectionfailed';     player.onnetworkdisconnected = 'controller.networkdisconnected';     player.onstreamnotfound = 'controller.streamnotfound';      $$(document).ajaxerror(function(e, xhr, settings, exception) {        alert('error (' + xhr.status + ') ' + 'in: ' + settings.url + ' | error: ' + exception);        if(xhr.status === 0 || xhr.status === 408 || xhr.status === 504) controller.networkdisconnected();     });      $$(document).ajaxsuccess(function(event, xhr, settings){         alert('ajaxsuccess('+xhr.status+'): ' + settings.url);         if(settings.url.indexof('http:') === 0) {             if(controller.no_network) {                 controller.no_network = false;                 controller.hidenotification();             }         }     }); }  controller.connectionfailed = function() {     alert("stream connection failed");     controller.no_network = true;     controller.shownotification('nema mreze'); }  controller.networkdisconnected = function() {     alert('networkdisconnected');      controller.no_network = true;     controller.shownotification('nema mreze');       if(typeof sf.scene.get('youtube') != 'undefined' && sf.scene.get('youtube').isvideoplaying){         sf.scene.hide('overlay');     } else {          sf.scene.get('content').streamstop(false);     }      sf.scene.get('content').streamstop(false); }  controller.networkresumed = function() {     alert('networkresumed');      controller.no_network = false;      controller.hidenotification();      if(controller.starting){         controller.startup();     } else {         alert("start timeout on resume");         $('#buffering').show();         settimeout(function(){             sf.scene.get('content').streamresume(false);             $('#buffering').hide();         }, 5000);     } }  controller.isconnectionavailable = function() {      if(sf.core.getenvvalue("modelid") == 'sdk') return controller.sdk_network;      var network = document.getelementbyid('pluginobjectnetwork');      var interfacetype = network.getactivetype();      if(interfacetype === -1) return false;      var physicalconn = network.checkphysicalconnection(interfacetype);      if(physicalconn !== 1) return false;      var httpstatus = network.checkhttp(interfacetype);      if(physicalconn !== 1) return false;      return true; }  controller.pollnetwork = function() {     alert('polling network');      var prevstatus = controller.no_network;     controller.no_network = !controller.isconnectionavailable();      if(! controller.no_network && prevstatus) {         controller.networkresumed();     }     else if(controller.no_network && ! prevstatus) {         controller.networkdisconnected();     }      settimeout(controller.pollnetwork, 2000); } 

does have idea how fix ? !

i suggest check xhr.responsetext before deciding it's succeed. happened 200 code status response body empty


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -