Quick-start Guide
quick-start guide this topic is an introduction to developing web applications for samsung tv it describes how to get started with the samsung tv sdk, the characteristics and structure of tv web applications, some useful apis and features, and ways you can test your applications related info tizen developers api references this topic is intended for developers with experience in creating web applications if you have not developed a tizen web application before, first familiarize yourself with tizen developers to begin application development with the samsung tv sdk set up the development environment install the samsung tv sdk create a certificate profile according to the tizen policy, all applications must be signed with valid certificates before they can be installed or run the signature verifies the source of the application and makes sure it has not been tampered with since its publication importantkeep your certificates backed up in a safe location when you update your published applications, the update must be signed with the same author certificate as the original application if the applications are signed with different author certificates, the update can be recognized as a different application and not an update design your application create a project you can select from various predefined templates implement application features test the application if you have questions about using the sdk, share them in the community forum designing applications when designing a web application for a samsung tv, pay attention to the following application characteristics remote control functionality the remote control is the main way for users to interact with the tv for more information, see user interaction simple ui the tv has a simpler user interface ui than a mobile device you must consider the user experience when designing the ui for more information, see design principles when you develop web applications for smart tv scalable application resolution on samsung tv, the screen aspect ratio is 16 9 for the uhd tv model groups, the standard application resolution is 1920x1080 px, and for the fhd tv model groups, it is 1280x720 px to prevent whitespace and scroll bars from appearing when the application screen is scaled, keep the aspect ratio at 16 9 even when the application resolution is different from the standard common web application features tv web applications can have most of the same features as web applications for other devices you can use web standard functions, such as mouse support, video elements, animations, and visibility change notifications you can also use tizen web device apis and samsung product apis supported by samsung tv for more information, see the api reference implementing application features a tizen web application consists of html, css, and js files, and a "config xml" file all tizen web application projects must have a "config xml" file in the project root directory the configuration file is composed of xml elements, including the <widget> element as its root these elements represent the application information, such as version, features, and privileges available for the application the configuration information is used when you install or run the tizen web application for more information, see configuring web applications you can implement the following features in your application tizen web device api and tv features the following tizen apis are useful for tv service applications tvwindow api you can use tizen web device apis to show the tv screen or external inputs in an application for example, you can implement picture-in-picture pip using the show function of the tvwindow api tizen tvwindow show function {}, null, ['0', '0', '50%', '50%'], 'main' ; for more information, see implementing pip tvaudiocontrol api you can control the volume level or mute status of the tv, using the tvaudiocontrol api tizen tvaudiocontrol setmute true ; tizen tvaudiocontrol setvolume 10 ; samsung product api and vod features the samsung product api provides additional functionalities beyond those offered by the tizen web api, such as retrieving information about the device and platform, displaying subtitles, and playing vods you can implement vod playback in 2 ways using video elements you can use the html5 standard video element for more information, see using video elements using the avplay api vod playback can be implemented using the avplay api, which has additional features, such as support for drm technologies for more information, see using avplay the following remote control keys are needed to control vod playback volume control to control vod playback volume levels, you can use the volume keys of the remote control without registering them, because they are handled at the platform level volume control can also be implemented using the tizen api for more information, see tvaudiocontrol api "play/pause" key the smart control "play/pause" key combines the functions of the "play" and the "pause" keys its keyname is mediaplaypause and the keycode is "10252" vod service applications must handle this key to toggle between play and pause modes screensaver to prevent screen burn, the screensaver is shown after a defined amount of time, if the tv screen has been displaying a still image or if there has been no user input for more information, see setting screensaver viewport scaling if you create an application for resolutions different than the standard resolutions, you can scale the resolution up or down, using the viewport meta element for more information, see managing screen resolution input method editor ime when an input or textarea element is focused, the virtual keyboard is shown the virtual keyboard is automatically hidden when a key on a connected external keyboard is pressed for more information, see keyboard / ime multitasking when the user switches from your application to another application or tv channel, your application must save its current state to ram and enter the hidden state you can receive notifications when an application is shown or hidden by registering a callback for the visibilitychange event document addeventlistener 'visibilitychange', function { if document hidden { } else { } } ; for more information, see multitasking iframe elements you can insert remote pages into your application using the web standard iframe element for more information, see the w3c recommendation for html5 <iframe width='960px' height='540' src='https //www youtube com/embed/7xbt-udahx8'></iframe> notewhen using iframe elements in tv applications, the following limitations apply only the following sandbox attributes are available allow-same-origin, allow-scripts, allow-forms, allow-top-navigation tizen and samsung product apis cannot be used in iframe elements the "frame flattening" feature, supported in tizen mobile web applications, is not supported in tv applications on the emulator, iframe elements for remote sources do not work as expected web storage and tv file system you can store application content and data, such as user information, in web storage and the tv file system for more information, see using web storage and managing file operations notefor your application to be published on samsung apps tv, you must make sure that all user login information is deleted when the application is uninstalled after deleting and reinstalling the application, there must be no user login information available from the previous installation tls support to transmit encrypted information between web browsers and web servers, samsung tv supports tls transport layer security versions 1 0, 1 1, and 1 2 ssl secure sockets layer is not supported testing applications to test your application during development, you can use the tv simulator and emulator tools provided in the samsung tv sdk, or an actual samsung tv tv simulator the tv simulator is a light-weight tool that simulates samsung tv apis using a javascript backend the simulator is useful when quick prototype development is required, such as when developing the ui you can modify the html5, js, and css code, and quickly reload the simulator to view your changes api support on the simulator is limited; the simulator does not support any features that have strict dependencies on tv hardware or core tizen modules some api functions return dummy values tv emulator the tv emulator is a tool that provides an environment similar to a real device if you do not have the real device, you can test on a virtual device with similar features the emulator supports most of the device apis, so it is useful when implementing the features of your application tv device if you have tested your application on the emulator, it is ready for uploading and testing on a tv even though it is possible to complete most application testing on the emulator, it is highly recommended that you also test your application on a target device the emulator and tv environments are very similar, but there are some differences at the hardware level