{"id":44463,"date":"2017-01-04T23:12:18","date_gmt":"2017-01-04T17:42:18","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=44463"},"modified":"2017-01-04T23:12:18","modified_gmt":"2017-01-04T17:42:18","slug":"how-to-convert-a-tizen-application-to-orsay","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/how-to-convert-a-tizen-application-to-orsay\/","title":{"rendered":"How to Convert a Tizen Application to Orsay?"},"content":{"rendered":"<p><strong>Introduction<\/strong><br \/>\nMost of the <a title=\"6 Top Considerations for Building a Connected TV Experience\" href=\"http:\/\/www.tothenew.com\/blog\/6-top-considerations-for-building-a-connected-tv-experience\/\">Smart TVs applications<\/a> are web based and are primarily developed using <a title=\"HTML\/CSS\" href=\"http:\/\/www.tothenew.com\/blog\/category\/technology\/html\/\">HTML and CSS<\/a>. In case the native component of Smart TV is not used, it is easy to develop an application that can run on different Smart TVs such as\u00a0Orsay, Tizen, LG, Opera, Smart Alliance, Amazon Fire etc.<\/p>\n<p>You can <a title=\"Smart TV Application Development Services\" href=\"http:\/\/www.tothenew.com\/mobile-smart-tv-application-development\">develop a Smart TV application<\/a> for a specific TV and port the same application for another TV. Here in this blog, I will explain how to convert an Angular based Tizen application to Samsung Orsay.<\/p>\n<p><em>Here, <a title=\"Angularjs development services\" href=\"http:\/\/www.tothenew.com\/front-end-angularjs-development\">AngularJS based application<\/a> is based on HMTL\/UI component instead of Native UI component and the focus handling is done by AngularJS or JavaScript.<\/em><\/p>\n<p><strong>Prerequisites<\/strong><\/p>\n<p>To convert a Tizen application to Orsay, \u00a0you must require a running Tizen code, <a title=\"Building Samsung Smart TV Application\" href=\"http:\/\/www.tothenew.com\/blog\/building-samsung-smart-tv-application\/\">Samsung Smart TV<\/a> SDK with IDE and knowledge about HTML, JavaScript, CSS and AngularJS.<\/p>\n<p><strong>Steps to Covert the Application<\/strong><\/p>\n<p>1. Create the sample project for Orsay TV.<br \/>\n2. It automatically creates two files &#8211;\u00a0<strong>widget.info<\/strong>,\u00a0which is used for managing the resolution; <strong>config.xml<\/strong>,\u00a0which contains the complete configuration of the project. Now delete the config file of the Tizen application and paste the complete Tizen code in sample.<br \/>\n3. Delete the Tizen dependent file from index like &#8211;<\/p>\n<p>[xml]<br \/>\n&lt;script src=&quot;$WEBAPIS\/webapis\/webapis.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;[\/xml]<\/p>\n<p>4. Now add the common APIpi in Index.html to run your application.<\/p>\n<p>[xml]<br \/>\n&lt;!&#8211; Common widget API&#8211;&gt;&lt;script type=&quot;text\/javascript&quot;<br \/>\n\tsrc=&quot;$MANAGER_WIDGET\/Common\/API\/Plugin.js&quot;&gt;&lt;\/script&gt;<br \/>\n&lt;script type=&quot;text\/javascript&quot;<br \/>\n\tsrc=&quot;$MANAGER_WIDGET\/Common\/Plugin\/Define.js&quot;&gt;&lt;\/script&gt;<br \/>\n&lt;script type=&quot;text\/javascript&quot; language=&quot;javascript&quot;<br \/>\n\tsrc=&quot;$MANAGER_WIDGET\/Common\/API\/Widget.js&quot;&gt;&lt;\/script&gt;<br \/>\n&lt;script type=&quot;text\/javascript&quot; language=&quot;javascript&quot; src=&quot;$MANAGER_WIDGET\/Common\/API\/TVKeyValue.js&quot;&gt;&lt;\/script&gt;<br \/>\n[\/xml]<\/p>\n<p>5. Now add the caph library in Index.html.<\/p>\n<p>[xml]<br \/>\n&lt;!&#8211; Caph Library &#8211;&gt;<br \/>\n&lt;script src=&quot;$CAPH\/1.0.0\/caph-level1-unified.min.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;<br \/>\n[\/xml]<\/p>\n<p>6. Add the function to onload of body to start the application.<\/p>\n<p>[xml]<br \/>\n&lt;body onload=&quot;func_onLoad();&quot;&gt; &lt;\/body&gt;<br \/>\n[\/xml]<\/p>\n<p>7. Add script to the head of index.html which contains the func_onLoad(), required to start the application.<\/p>\n<p>[javascript]<br \/>\n&lt;script&gt;<br \/>\n\tvar flag = false;<br \/>\n\tvar widgetAPI = new Common.API.Widget();<br \/>\n\tvar pluginAPI = new Common.API.Plugin();<br \/>\nfunction func_onLoad() {<br \/>\n\tif (typeof curWidget != &#8216;undefined&#8217;) {<br \/>\n\t\tcurWidget.setPreference(&quot;ready&quot;, &quot;true&quot;);<br \/>\n\t}<br \/>\n\tif (!caph.platform.dtv.Browser<br \/>\n\t\t\t\t|| caph.platform.dtv.Browser.browserType().sectvbd) {<br \/>\n\t\t} else {<br \/>\n\t\t\twidgetAPI.sendReadyEvent();<br \/>\n\t\t}<br \/>\n\t}<br \/>\n\twindow.onShow = function(e) {<br \/>\n\t\tif (flag === false) {<br \/>\n\t\t\tflag = true;<br \/>\n    \/\/ This line start the application<br \/>\n\t\t\twidgetAPI.sendReadyEvent();<br \/>\n\t\t}}<br \/>\n&lt;\/script&gt;[\/javascript]<\/p>\n<p>8. Change the mapping of TV keys of Tizen to Orsay. Now your application is running fine along with the focus of the application.<\/p>\n<p>These are the Orsay keys &#8211;<\/p>\n<p>[javascript]<br \/>\nvar tvKeyOrsay = new Common.API.TVKeyValue();<br \/>\nvar tvKey = {<br \/>\nKEY_RETURN : tvKeyOrsay.KEY_RETURN,<br \/>\nKEY_PANEL_RETURN : tvKeyOrsay.KEY_PANEL_RETURN,<br \/>\nKEY_EXIT : tvKeyOrsay.KEY_EXIT,<br \/>\nKEY_UP : tvKeyOrsay.KEY_UP,<br \/>\nKEY_DOWN : tvKeyOrsay.KEY_DOWN,<br \/>\nKEY_LEFT : tvKeyOrsay.KEY_LEFT,<br \/>\nKEY_RIGHT : tvKeyOrsay.KEY_RIGHT,<br \/>\nKEY_ENTER : tvKeyOrsay.KEY_ENTER,<br \/>\nKEY_PANEL_ENTER : tvKeyOrsay.KEY_PANEL_ENTER,<br \/>\nKEY_VIDEO_REWIND : tvKeyOrsay.KEY_RW,<br \/>\nKEY_VIDEO_FASTFORWARD : tvKeyOrsay.KEY_FF,<br \/>\nKEY_PLAY_PAUSE : tvKeyOrsay.KEY_PLAY_PAUSE,<br \/>\nKEY_VIDEO_PLAY : tvKeyOrsay.KEY_PLAY,<br \/>\nKEY_VIDEO_PAUSE : tvKeyOrsay.KEY_PAUSE,<br \/>\nKEY_VIDEO_STOP : tvKeyOrsay.KEY_STOP,<br \/>\nKEY_MUTE : tvKeyOrsay.KEY_MUTE,<br \/>\nKEY_VOLUME_UP : tvKeyOrsay.KEY_VOL_UP,<br \/>\nKEY_KEY_PANEL_VOL_UP : tvKeyOrsay.KEY_PANEL_VOL_UP,<br \/>\nKEY_PANEL_VOL_DOWN : tvKeyOrsay.KEY_PANEL_VOL_DOWN,<br \/>\nKEY_VOLUME_DOWN : tvKeyOrsay.KEY_VOL_DOWN<br \/>\n};<br \/>\n[\/javascript]<\/p>\n<p>9. The back navigation is still not working so you need to block the default navigation to handle the return keys of remote control.<\/p>\n<p>[javascript]<br \/>\nwindow.addEventListener(&quot;keydown&quot;, function (event) {<br \/>\nswitch (event.keyCode) {<br \/>\ncase tvKey.KEY_RETURN:<br \/>\n\/\/do what ever you required.<br \/>\nvar widgetAPI = new Common.API.Widget();<br \/>\nwidgetAPI.blockNavigation(event);<br \/>\nbreak;}}<br \/>\n[\/javascript]<\/p>\n<p>10. Also need to change the exit key functionality.<\/p>\n<p>[javascript]<br \/>\nwindow.addEventListener (&quot;keydown&quot;, function (event) {<br \/>\nswitch (event.keyCode) {<br \/>\ncase tvKey.KEY_EXIT:<br \/>\nvar widgetAPI = new Common.API.Widget();<br \/>\nwidgetAPI.sendExitEvent(event);<br \/>\nbreak;}<br \/>\n}<br \/>\n[\/javascript]<\/p>\n<p>Following these 10 simple steps can help you to convert your normal Tizen application to Orsay.<\/p>\n<p>If your application uses the following features then it is mandatory to convert these features also.<\/p>\n<p>1. Network connection scanning<br \/>\n2. Getting device information like UDID\/Model No etc<br \/>\n3. Application resolution<br \/>\n4. Key board handling<br \/>\n5. Video player<\/p>\n<p><strong>Few points to remember\u00a0<\/strong><\/p>\n<p>1. Make a folder according to the platforms which contains the platform dependent js and features so that it is easier\u00a0to locate the features that needs to be changed and removed.<\/p>\n<p>2. Include all the Platform dependent features in one place and include your comments so that is can easily replaced.<br \/>\nFor example &#8211;<!-- Tizen Library --><\/p>\n<p>[xml]<br \/>\n&lt;script src=&quot;$WEBAPIS\/webapis\/webapis.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;<br \/>\n[\/xml]<\/p>\n<p>3. If the HTML contains the platform dependent features then make a sub-folder such as views in the platforms folder directory.<br \/>\n4. Create a separate platform dependent utils to perform the operations such as return, exit etc.<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>By this approach, you can easily convert a Tizen application to Samsung Orsay. Through this you can save\u00a0time and effort and can covert applications for different Smart TVs.<\/p>\n<p><strong>Note:\u00a0<\/strong><\/p>\n<p>The process to convert the application is just not restricted to Orsay but can be used for most of the web-based TVs such as LG, Opera, Amazon Fire and Smart Alliance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Most of the Smart TVs applications are web based and are primarily developed using HTML and CSS. In case the native component of Smart TV is not used, it is easy to develop an application that can run on different Smart TVs such as\u00a0Orsay, Tizen, LG, Opera, Smart Alliance, Amazon Fire etc. You can [&hellip;]<\/p>\n","protected":false},"author":864,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":60},"categories":[1439,3479,3477,1],"tags":[4322,4842,4334,4335,4861,4351],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/44463"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/864"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=44463"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/44463\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=44463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=44463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=44463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}