Toggle screensaver in Samsung Smart TV

Samsung Smart TV

In this article we are going on discuss on toggling a screen saver in Samsung smart TV. Screensaver is enabled by default in Samsung smart TV and comes into action when the user is not doing an action for a certain period of time. In most of the TV models, the idle time interval can be programmed by the user. Sometimes the screensaver has to be disabled in order for some applications to run smoothly. The most common examples being the video applications. This article explains how the developer can disable the screensaver and enable it back in a video application.

During the playing of a video file, the screensaver should be disabled for the continuous viewing experience. For this purpose the screensaver that is enabled by default should be disabled by the application developer. Appearance of screensaver in between the video play sequence disturbs the viewing experience. In order to use the screensaver controls, the developer has to import  the service API library.

The following code snippet has to be attached with the head section of the app landing page (index.html).

<script type='text/javascript' language='javascript' src='$MANAGER_WIDGET/Common/af/2.0.0/loader.js'></script>

Once this library is included, we can control the screensaver activity. Mostly in the context of a video application, the screensaver should be disabled during the playing of a video player. During the playing of a video, the user will not be doing activity which may count to idle time thus enabling the screensaver. The developer has to prevent the screensaver during the video play activity. The following code snippet does that

//Inside the play or resume callback function
sf.service.setScreenSaver(true, 100);

The disabled screensaver during the video playback has to be enabled back when the video playback is complete. Same case applies for whatever application, the screensaver has to be brought back when the purpose for which it is disabled is complete. The following code enables the screensaver.

//Inside the callback of pause or stop

Thus the screensaver can be enabled and disabled based on the developer preferences. The developers who are developing video applications should have to consider the screensaver concept in mind. In the next article, we will be concentrating on developing a simple video application using the Samsung smart TV platform.

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: