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.


Related Info


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

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

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



* New Cloud TV app is not supported after '19.

Prerequisites

Include the library in your Smart TV applications HTML page

<!DOCTYPE html>
<html>
<head lang="en">
    
    <script src="scripts/vendor/msf-2.0.x.min.js"></script>
</head>
...
</html>

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.

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)

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