Reputation: 44550
I am trying to develop app for Samsung SmartTV, that plays HAS(HLS) video stream.
I am trying to go through http://www.samsungdforum.com/Guide/tut00055/index.html guide. But it looks like at some point there is one variable in the guide that is never defined. Try to search for 'sf'. Here is code example (from the guide):
Player.init = function () {
var success = true;
alert("success vale : " + success);
this.state = this.STOPPED;
sf.service.VideoPlayer.init({ //sf is not defined.
onstatechange : function(state) {
alert("Current State : " + state);
},
onend : function() {
alert("Video ended.");
},
onerror : function(error) {
alert("Error : " + error);
}
});
this.setWindow();
alert("success vale : " + success);
return success;
}
Where is the declaration of this variable?
Are there any super simple samples of video player for samsung smart tv?
Upvotes: 0
Views: 3859
Reputation: 876
I usually proceed by creating the apps with the basic project (scene) framework 2.0 (using SDK 5.0), And I can access the sf variable anywhere in my scene. And my code to play a HLS Stream is as follows:
sf.service.VideoPlayer.setKeyHandler(sf.key.RETURN,function(){
sf.service.VideoPlayer.stop();
});
sf.service.VideoPlayer.play({
url: "http://example.com/app_name/stream_name/playlist.m3u8",
fullScreen: true // Sets Player to partial mode
});
As far as I understand, the sf variable is available because of the following javascript file included in index.html file.
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/af/2.0.0/loader.js"></script>;
And hopefully, with JavaScript Apps too, the same loader.js file should be included.
Upvotes: 3