Javascript SDK for Smart view does not work!

Downloaded the package from -> https://developer.samsung.com/smarttv/develop/extension-libraries/smart-view-sdk/download.html

I get an error when I try to import the msf-2.3.4.min.js file which comes in that package. Trying to implement just the basic code to discover TV in my network.

Code ->

msf.search(function(err, services){
    if(err) return console.error('something went wrong', err.message);
    console.log('found '+services.length+' services');
});

Error in console ->

Cannot read property '1' of null at RTCPeerConnection.n.onicecandidate

Please help if you know any other way to connect to my app using javascript API’s

Thank you

1 Like

Did you solve the problem? I have the similar issue with msf-2.3.4.min.js
When I run

	var search = msf.search();
	search.on('found', function(services) {
		for (var i = 0; i < services.length; i++) {
			console.log('Found service ' + services[i].name);
			alert(services[i].name);
		}
	});
	search.start();

on emulator - nothing happens.
Run on the device SM-R800 (galaxy watch) cause error
Uncaught (in promise) DOMException: Failed to set local offer sdp: Failed to create channels.

version msf-2.0.22.min.js does nothing for emulator and for device.

I have the same issue. The error is caused by the IP address parsing snippet below:

// Line below is from source map: msf://lib/util/Search.js line 54
    pc.onicecandidate = function(ice){  //listen for candidate events
        if(!ice || !ice.candidate || !ice.candidate.candidate)  return;
        var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
        var pc2 = new MTgetByURI(myIP);
        setTimeout(function(){sendTVList();},3000);
        pc.onicecandidate = noop;
    };

There is no IP address in ice.candidate.candidate and therefore no match from RegExp.exec(). The strings I have encountered in ice.candidate.candidate are:

Chrome 108.0.5359.124 (64-bit) on Linux: 
"candidate:3568087678 1 udp 2113937151 ef312aaf-9672-41cf-9e82-df01ea85b8e2.local 54875 typ host generation 0 ufrag nJF2 network-cost 999"

Firefox Developer edition 109.0b9 (64-bit) on Linux:
"candidate:0 1 UDP 2122187007 c17ee565-5ac9-421b-aa61-ccd34a205f37.local 59176 typ host"

I’ve replaced the myIP variable with my IP, and nothing. I don’t know where even start to debug this thing.
Do you have any new information?.