Including Gestures in Smart TV Apps

13
Including gestures in Smart TV apps Manikantan K [email protected] @manikantan_k
  • date post

    17-Oct-2014
  • Category

    Technology

  • view

    3.051
  • download

    0

description

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

Transcript of Including Gestures in Smart TV Apps

Page 1: Including Gestures in Smart TV Apps

Including gestures in Smart TV apps

Manikantan K

[email protected]@manikantan_k

Page 2: Including Gestures in Smart TV Apps

Motion Recognitionhttp://www.samsungdforum.com/Guide/d01/index.html

Page 3: Including Gestures in Smart TV Apps
Page 4: Including Gestures in Smart TV Apps
Page 5: Including Gestures in Smart TV Apps
Page 6: Including Gestures in Smart TV Apps
Page 7: Including Gestures in Smart TV Apps

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 listenerdocument.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);

Page 8: Including Gestures in Smart TV Apps

Double Handed Gestures• Include webapis

<script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>

• Usage.• Check for support and enabledif (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 eventswebapis.recognition.SubscribeExEvent(webapis.recognition.PL_RECOGNITION_TYPE_GESTURE, “returnID", function (evt) { that.handleRecognitionEvent.call(that, evt); });

EVENT_GESTURE_2HAND_ZOOM , EVENT_GESTURE_2HAND_ROTATE etc

Page 9: Including Gestures in Smart TV Apps

Voice Recognitionhttp://samsungdforum.com/Guide/tut000001/index.html

Page 10: Including Gestures in Smart TV Apps

Voice Recognition• Embedded Mode

Predefined voice commands.The engine does more of comparison than recognitionDoes NOT require internet.Limited to comparing between 7 items.

• Server Guide ModeFree- form speech.Depends heavily on user’s linguistics and pronunciation.Voice Data is sent to internet to recognize user’s speech.No limits.

Page 11: Including Gestures in Smart TV Apps

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 enableddeviceapis.recognition.IsRecognitionSupported()deviceapis.recognition.IsVoiceRecognitionEnabled()deviceapis.recognition.IsVoiceServerLanguageSupported()

Page 12: Including Gestures in Smart TV Apps

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 eventsMain.onVoiceEvent = function(evt){

switch (evt.eventtype){case 'EVENT_VOICE_RECOG_RESULT':

alert('The user say ' + evt.result);break;

}};

Page 13: Including Gestures in Smart TV Apps

Thank You