Including Gestures in Smart TV Apps

3,653 views

Published on

Quick overview and code snippets to include Motion Recognition and Voice recognition capability in your Smart TV apps for Samsung.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,653
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Including Gestures in Smart TV Apps

  1. 1. Including gestures in Smart TV apps Manikantan K Manikantan.k@samsung.com @manikantan_k
  2. 2. Motion Recognition http://www.samsungdforum.com/Guide/d01/index.html
  3. 3. 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);
  4. 4. Double Handed Gestures • Include webapis <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script> • Usage. • Check for support and 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
  5. 5. Voice Recognition http://samsungdforum.com/Guide/tut000001/index.html
  6. 6. 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.
  7. 7. Voice Recognition • Include webapis and in config.xml <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js "></script> <voice>y</voice> in config.xml • Check for support and if enabled deviceapis.recognition.IsRecognitionSupported() deviceapis.recognition.IsVoiceRecognitionEnabled() deviceapis.recognition.IsVoiceServerLanguageSupported()
  8. 8. Voice Recognition • Subscribe to Voice Events deviceapis.recognition.SubscribeExEvent( deviceapis.recognition.PL_RECOGNITION_TYPE_VOICE, "VoiceEvt", Main.onVoiceEvent ); deviceapis.recognition.UnsubscribeExEvent( deviceapis.recognition.PL_RECOGNITION_TYPE_VOICE, "VoiceEvt” ); • Handle voice events Main.onVoiceEvent = function(evt){ switch (evt.eventtype){ case 'EVENT_VOICE_RECOG_RESULT': alert('The user say ' + evt.result); break; } };
  9. 9. Thank You

×