top

Receiver Apps

You can build your own receiver application with Smart View SDK. Or, you can utilize the default application that is provided by Samsung. The Smart View SDK provides various options where you can take one that best suits for your needs.

Receiver App

TV Apps are created as standard HTML5 apps. You can create your TV app using the TizenTV IDE, or any editor that you choose.

Installed TV App

You can add Smart View feature on existing Samsung Smart TV apps. Using Smart View SDK, the sender application can install and launch your TV app with its app ID.

  • Downloadable and launchable with a TV remote
  • Direct access on Smart Hub
  • Full access to Tizen or Samsung Legacy Platform APIs
Note

Smart View SDK should be incorporated into existing TV apps on target models - if available - rather than duplicating similar functionality within a cloud app as it will confuse users.

How to launch Tizen app on the TV?

  1. Download sample Tizen installed app - Check Launch Installed App
  2. Build/run mobile app(s).
  3. Build the TV app using the Tizen IDE
  4. Refer to “Running App on TV
    • Put TV in development mode and register dev machine
    • Create a target on IDE that points to the TV (Go to the Connection explorer panel -> Remote device manager icon and enter the the TV IP address (The TV and the dev machine has to be in the same network).
    • Run the project as a Tizen Web application (right click project -> Run as -> Tizen Web application).

Cloud TV App

You can host the receiver application on your own cloud based server. Using Smart View SDK, the sender application can launch the cloud app with its URL.

  • Not downloadable or launchable with a TV remote
  • No access on TV screen
  • Limited access to Tizen APIs or Samsung Legacy Platform APIs

How to launch Smart View cloud app on TV

  1. Download sample cloud app - check Launch Cloud App
  2. Build/run mobile app(s).
  3. Host the ‘dist’ directory in the TV app somewhere where it can be accessed by the TV. (If you have node.js installed in the development machine, you can do npm install, followed by gulp build and gulp server to serve the TV app locally from your development machine).
  4. Put the TV in development mode and register the IP of a client machine (phone/laptop). see below - How to put the TV in development mode?
  5. Power cycle the TV.
  6. On TV, under Network Status, find IP address of the TV.
  7. Goto the TV developer settings page at http://:8001 using a browser from the registered client.
  8. Check “Allow all content” checkbox in the settings page and submit the form (along with the CAPTCHA text).

Default Media Player (DMP)

You can utilize the default application provided by Samsung as a receiver. Using Smart View SDK, the sender application can send a content URL to play it with the DMP(Default Media Player).

  • Not downloadable or launchable with a TV remote
  • No access on TV screen
  • Basic player with a fixed UI
  • Non-DRM content
  • Supported media type

Choose a Receiver

Prerequisites

Include the library in your Smart TV applications HTML page




    
    

...

API Usage

Initializing a TV Application

Your TV app is created in HTML5. When your TV app loads, the first thing you’ll want to do is initialize the Smart View SDK, so that your TV app can receive messages from a mobile application.

Unlike a mobile application, you don’t need to “discover” TVs from your TV application. You “are” the TV application, so all you need to do is get a reference to the current or “local” device.

Note

You typically should do this initialization as soon as your TV application loads. For example, do the initialization in the window.onload event. You TV app will not receive messages from your mobile application until this initialization is complete. Also, your mobile application will not receive the “onConnect” event until this is complete.

The basic workflow is:

  • Get a reference to the “local” service
  • Connect to a communication “channel”
  • Add Event Listeners
// Get a reference to the local "service"

window.msf.local(function(err, service) {
    if (err) {
        console.log('msf.local error: ' + err);
        return;
    }

    // Create a reference to a communication "channel"
    var channel = service.channel('com.yourcompany.yourapp');

    // Connect to the channel
    channel.connect(function (err) {
         if(err) return console.error(err);
         console.log('You are connected');
     });

    // Add a message listener. This is where you will receive messages from mobile devices
    channel.on('fireMissile', function(msg, from){
         console.log(from.attributes.name + ' says, ' + msg);
     });

    // Add a listener for when another client connects, such as a mobile device
    channel.on('clientConnect', function(client){
        // Send the new client a message
         channel.publish('say', 'Hello '+client.attributes.name, client.id);
     });
});

Enhanced Features

TLS (make secure connection)

Note

It need to update mobile library to use TLS feature
Android 2.3.7 higher
iOS 2.3.8 higher
JS 2.3.3 higher

SmartviewSDK can make secure connection between sender and receiver through wss & http

refer to latest CastVideo sample app.

1) setSecurityMode API : This API is only receiver app .

application.setSecurityMode(securityMode)

  • Set security mode status to for web socket connection or rest API
  • Parameters:
    • securityMode - security mode status to set

2) Sample Code
Tizen Web APP(Receiver app)

     var channel = service.channel(mChannel);
    
     channel.setSecurityMode(true);

     channel.connect({name: 'TV'}, function (err) {
         if(err) {
          return console.log(err);
         }
         log('channel.connect');
     }); 


Error Code

Following are the specific errors to able to receive the message in the onError()

Code Description
401 UNAUTHORIZED Error
404 NOT_FOUND Error
500 Internal Server Error