© 2013 Samsung Electronics Co., Ltd. All rights reserved.
This API provides screen control functionality such as showing/hiding and selecting an input source for the device associated with the TV.
A webapis.tv.window object that provides access to the functionality of the window API.
For more information on the TV Window features, see TV Window Guide.
Interface | Method |
---|---|
WebAPIsTVWindowManager | |
TVWindowManager | void getAvailableWindow(AvailableWindowListCallback successCallback, ErrorCallback errorCallback) void setSource(SourceInfo sourceInfo, SourceChangedSuccessCallback sourceChangedSuccessCallback, ErrorCallback? errorCallback, unsigned short windowID) SourceInfo getSource(unsigned short windowID) boolean setRect(SRect rect, unsigned short windowID) boolean show(unsigned short windowID) boolean hide(unsigned short windowID) |
SourceInfo | |
AvailableWindowListCallback | void onsuccess(UnsignedShortArray windowArray) |
SourceChangedSuccessCallback | void onsuccess(SourceInfo info, unsigned short windowID) |
The TV Window module supports control of source relative functions of the Smart TV platform.
[NoInterfaceObject] interface WebAPIsTVWindowManager { readonly attribute TVWindowManager window; };
TV implements WebAPIsTVWindowManager;
There is a webapis.tv.window object that allows access to TV Window API functionality.
Defines what is instantiated in the tv object.
[NoInterfaceObject] interface TVWindowManager { const unsigned long SOURCE_MODE_TV = 0; const unsigned long SOURCE_MODE_AV = 1; const unsigned long SOURCE_MODE_SVIDEO = 2; const unsigned long SOURCE_MODE_COMP = 3; const unsigned long SOURCE_MODE_PC = 4; const unsigned long SOURCE_MODE_HDMI = 5; const unsigned long SOURCE_MODE_SCART= 6; const unsigned long SOURCE_MODE_DVI = 7; const unsigned long SOURCE_MODE_MEDIA = 8; const unsigned long SOURCE_MODE_IPTV = 9; void getAvailableWindow(AvailableWindowListCallback successCallback, optional ErrorCallback errorCallback); void setSource(SourceInfo sourceInfo, SourceChangedSuccessCallback sourceChangedSuccessCallback, optional ErrorCallback? errorCallback, optional unsigned short windowID); SourceInfo getSource(optional unsigned short windowID); boolean setRect(SRect rect, optional unsigned short windowID); boolean show(optional unsigned short windowID); boolean hide(optional unsigned short windowID); };
A webapis.tv.window object that provides access to the functionality of the window module.
unsigned long SOURCE_MODE_TV
This identifier indicates the source is from TV.
unsigned long SOURCE_MODE_AV
This identifier indicates the source is from component.
unsigned long SOURCE_MODE_SVIDEO
This identifier indicates the source is from S-Video.
unsigned long SOURCE_MODE_COMP
This identifier indicates the source is from composite.
unsigned long SOURCE_MODE_PC
This identifier indicates the source is from PC.
unsigned long SOURCE_MODE_HDMI
This identifier indicates the source is from HDMI.
unsigned long SOURCE_MODE_SCART
This identifier indicates the source is from SCART.
unsigned long SOURCE_MODE_DVI
This identifier indicates the source is from DVI.
unsigned long SOURCE_MODE_MEDIA
This identifier indicates the source is from media.
unsigned long SOURCE_MODE_IPTV
This identifier indicates the source is from IPTV.
getAvailableWindow
Gets the number of available sub-window.
void getAvailableWindow(AvailableWindowListCallback successCallback, optional ErrorCallback errorCallback);
The ErrorCallback is launched with these error types:
If the errorCallback does not contain a valid function (such as null) or in the case of any other error that should be returned in the errorCallback (see above), the implementation MUST silently fail and no further action is required (that is the developer is not notified of the error).
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type TypeMismatchError if any of the input attributes are of the wrong type
function successCB(windows) { for (var i = 0; i windows.length; i++) { console.log("available window's ID is " + windows[i]); } } function errorCB(error) { console.log(error.name); } try { webapis.tv.window.getAvailableWindow(successCB, errorCB); catch (error) { console.log(error.name); }
setSource
Changes the tv source. (TV or PC or DVI ...)
void setSource(SourceInfo sourceInfo, SourceChangedSuccessCallback sourceChangedSuccessCallback, optional ErrorCallback? errorCallback, optional unsigned short windowID);
The ErrorCallback is launched with these error types:
If the errorCallback does not contain a valid function (such as null) or in the case of any other error that should be returned in the errorCallback (see above), the implementation MUST silently fail and no further action is required (that is the developer is not notified of the error).
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type TypeMismatchError if any of the input attributes are of the wrong type
function successCB() { console.log("setting source is successful"); } } function errorCB(error) { console.log(error.name); } try { webapis.tv.window.setSource( { type : webapis.tv.window.SOURCE_MODE_TV, number : 0 }, successCB, errorCB); } catch (error) { console.log(error.name); }
getSource
Returns a current source. (TV, PC, DVI, etc.)
SourceInfo getSource(optional unsigned short windowID);
with error type UnknownError, In the case of any other error
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError If the input attributes do not contain valid values
with error type TypeMismatchError if any of the input attributes are of the wrong type
function successCB(windows) { for (var i = 0; i windows.length; i++) { var source = webapis.tv.window.getSource(windows[i]); switch (source.type) { case webapis.tv.window.SOURCE_MODE_TV : console.log("window source is TV"); break; case webapis.tv.window.SOURCE_MODE_AV : console.log("window source is AV"); break; } } } function errorCB(error) { console.log(error.name); } try { webapis.tv.window.getAvailableWindow(successCB, errorCB); catch (error) { console.log(error.name); }
setRect
Sets the display area for video content on TV screen.
boolean setRect(SRect rect, optional unsigned short windowID);
with error type UnknownError In the case of any other error
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError If the input attributes do not contain valid values.
with error type TypeMismatchError if any of the input attributes are of the wrong type.
webapis.tv.window.setRect({ width : 320, height : 240, top : 0, left : 0 });
show
Shows the specific window for the display area on the TV screen.
boolean show(optional unsigned short windowID);
with error type UnknownError In the case of any other error
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError If the input attributes do not contain valid values
with error type TypeMismatchError if any of the input attributes are of the wrong type
function successCB(windows) { for (var i = 0; i windows.length; i++) { if (i == 0) { if (webapis.tv.window.show(windows[i])) { console.log("window #0 is shown"); } } } function errorCB(error) { console.log(error.name); } try { webapis.tv.window.getAvailableWindow(successCB, errorCB); } catch (error) { console.log(error.name); }
hide
Hides the specific window for the display area on the TV screen.
boolean hide(optional unsigned short windowID);
with error type UnknownError, In the case of any other error
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError If the input attributes do not contain valid values
with error type TypeMismatchError if any of the input attributes are of the wrong type
function successCB(windows) { for (var i = 0; i windows.length; i++) { if (i == 0) { if (webapis.tv.window.hide(windows[i])) { console.log("window #0 is hidden"); } } } function errorCB(error) { console.log(error.name); } webapis.tv.window.getAvailableWindow(successCB, errorCB);
Specifies the options for source information
dictionary SourceInfo { unsigned short type; unsigned long number; };
unsigned short type
a source type
unsigned long number
a source number
The callback after retrieving a list of windows successfully. This function is used to get a number of available sub windows.
[Callback=FuntionOnly, NoInterfaceObject] interface AvailableWindowListCallback { void onsuccess(UnsignedShortArray windowArray); };
onsuccess
Success callback for retrieving a list of windows.
void onsuccess(UnsignedShortArray windowArray);
This function is used to get the number of available subwindows.
The callback after window source has been changed successfully.
[Callback=FuntionOnly, NoInterfaceObject] interface SourceChangedSuccessCallback { void onsuccess(SourceInfo info, unsigned short windowID); };
This function is used to get the changed sourceInfo and the associated windowID.
onsuccess
The method which will be invoked after changing the window source successfully.
void onsuccess(SourceInfo info, unsigned short windowID);
module Window { [NoInterfaceObject] interface WebAPIsTVWindowManager { readonly attribute TVWindowManager window; }; TV implements WebAPIsTVWindowManager; [NoInterfaceObject] interface TVWindowManager { const unsigned long SOURCE_MODE_TV = 0; const unsigned long SOURCE_MODE_AV = 1; const unsigned long SOURCE_MODE_SVIDEO = 2; const unsigned long SOURCE_MODE_COMP = 3; const unsigned long SOURCE_MODE_PC = 4; const unsigned long SOURCE_MODE_HDMI = 5; const unsigned long SOURCE_MODE_SCART= 6; const unsigned long SOURCE_MODE_DVI = 7; const unsigned long SOURCE_MODE_MEDIA = 8; const unsigned long SOURCE_MODE_IPTV = 9; void getAvailableWindow(AvailableWindowListCallback successCallback, optional ErrorCallback errorCallback); void setSource(SourceInfo sourceInfo, SourceChangedSuccessCallback sourceChangedSuccessCallback, optional ErrorCallback? errorCallback, optional unsigned short windowID); SourceInfo getSource(optional unsigned short windowID); boolean setRect(SRect rect, optional unsigned short windowID); boolean show(optional unsigned short windowID); boolean hide(optional unsigned short windowID); }; dictionary SourceInfo { unsigned short type; unsigned long number; }; [Callback=FuntionOnly, NoInterfaceObject] interface AvailableWindowListCallback { void onsuccess(UnsignedShortArray windowArray); }; [Callback=FuntionOnly, NoInterfaceObject] interface SourceChangedSuccessCallback { void onsuccess(SourceInfo info, unsigned short windowID); }; };