Overview of getting started with Samsung Smart TV SDK 4.5 for an app developer. Outlines the different programming languages supported by the platform including HTML5, and some devices APIs.
ICT role in 21st century education and its challenges
Introduction to Samsung Smart TV SDK
1. Samsung Smart TV SDK
Manikantan K
Manikantan.k@samsung.com
@manikantan_k
2. What is Samsung SMART TV App?
• Samsung Smart TV applications are web-based small
software programs that run on Digital TVs connected to
the Internet.
• Applications are installed on TVs via Internet and run on
App Engine
Application Manager
App Engine
10. Smart TV SDK evolution
2.x
• Designed for 2011 Devices ( D Model )
• HTML5/CSS3 Support
• Maple Web Engine
3.x
• Designed for 2012 Devices ( E Model )
• Smart Interaction, In-Apps Ads & Convergence Support
• WebKit Web Engine
4.x
• Designed for 2013 Devices ( F Model )
• Smart Interaction 2.0 Support
• Eclipse Based IDE (Linux & Mac OS SDK Available)
http://www.samsungdforum.com
12. Improved HTML5 support
• Support for <video> and <audio> tags
• For formats & support, see link
<video src=“movie.mp4” width=“320” height=“240”>
No HTML5 video tag support.
</video>
http://www.samsungdforum.com/Guide/art00066/index.html
13. Improved HTML5 support
• Support for <canvas> tag
<canvas id=“example” width=“200” height=“200”>
This text is displayed if your browser does not support HTML5 canvas.
</canvas>
var example = document.getElementById(‘example’);
var context = example.getContext(‘2d’);
context.fillStyle = “rgd(255,0,0)”;
context.fillRect(30,30,50,50);
http://www.samsungdforum.com/Guide/art00066/index.html
14. Web Device API
List of APIs to access low level functionalities of the Smart TV like
•
•
•
•
•
•
•
•
Network capabilities
TV channels
Gamepad connectivity
External Camera support
Microphone
Filesystem
Voice recognition
MIDI etc
<script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>
15. Web Device API > Network
• Check network connection
• Set Listeners for changes
try {
webapis.network.getAvailableNetworks(successCB, errorCB);
} catch(err) {
alert(err.name);
}
function successCB(networks) {
for(var i=0; I < networks.length; i++) {
if(networks[i].isActive() ) {
networks[i].setWatchListener(watchCB, errCB);
}}
}
http://www.samsungdforum.com/Guide/ref00008/network/dtv_network_module.html
16. Web Device API > TVChannel
• Get ProgramList for current channel
try {
var channel = webapis.tv.channel.getCurrentChannel();
webapis.tv.channel.getProgramList(channel, webapis.tv.info.getEpochTime(),
successCB, errorCB, 3600 );
} catch(err) {
alert(err.name);
}
function successCB(programs) {
console.log(“program query success”);
}
http://www.samsungdforum.com/Guide/ref00008/tvchannel/dtv_tvchannel_module.htm
l
17. Single Handed Gestures
• You need to include mouse support in
config.xml
<mouse>y</mouse>
• Mouse listener like the web.
• Create a div in scene1.html
<div id="button0">Button</div> <!-- make it as button -->
<div id="div0“></div>
<!-- make it as trial element -->
• Adding listener
document.getElementById('div0').addEventListener('mouseover', function(){
document.getElementById('div0').style.backgroundColor = 'lime';
}, false);
document.getElementById('div0').addEventListener('mouseout', function(){
document.getElementById('div0').style.backgroundColor = 'yellow';
}, false);
document.getElementById('div0').addEventListener('click', function(){
alert("clicked");
}, false);
18. Double Handed Gestures
Check for support/enabled
if (webapis.recognition.IsRecognitionSupported()) {
if (webapis.recognition.IsGestureRecognitionEnabled()) {
// perform Recognition related actions here, e.g. subscribe }
else { alert("ERROR: Gesture recognition is not enabled"); }
} else { alert("ERROR: Gesture recognition not supported"); }
Subscribe to events
webapis.recognition.SubscribeExEvent(webapis.recognition.PL_RECOGNITION_T
YPE_GESTURE, “returnID", function (evt) { that.handleRecognitionEvent.call(that,
evt); });
EVENT_GESTURE_2HAND_ZOOM , EVENT_GESTURE_2HAND_ROTATE etc
19. Voice Recognition
• Embedded Mode
Predefined voice commands.
The engine does more of comparison than recognition
Does NOT require internet.
Limited to comparing between 7 items.
• Server Guide Mode
Free- form speech.
Depends heavily on user’s linguistics and pronunciation.
Voice Data is sent to internet to recognize user’s speech.
No limits.
20. Voice Recognition
• Add the voice tag in the config.xml
– <voice>y</voice>
• Include the following library in the index.html
– $MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js
– The VR library can be used under the deviceapis.recognition
object
• Set Helpbar!
21. Voice Recognition
• Not all TV Series have VR feature, it be best to
check device compatibility before using the
feature.
• Check Device VR Feature Availibility:
– deviceapis.recognition.IsRecognitionSupported()
• Check Device VR Feature Enabled or Disabled:
– deviceapis.recognition.IsVoiceRecognitionEnabled()
• Check Device Server Guide VR Availibility:
– deviceapis.recognition.IsVoiceServerLanguageSupported()
22. Voice Recognition
• Since the VR runs separately with apps, the apps must
subscribe to VR events to use the data from VR.
deviceapis.recognition.SubscribeExEvent(
deviceapis.recognition.PL_RECOGNITION_TYPE_VOICE,
"VoiceEvt",
Main.onVoiceEvent
);
deviceapis.recognition.UnsubscribeExEvent(
deviceapis.recognition.PL_RECOGNITION_TYPE_VOICE,
"VoiceEvt”
);