successCallback[optional][nullable] : Callback method to invoke if the request is successful
errorCallback[optional][nullable] : Callback method to invoke if the request fails
Exceptions :
WebAPIException
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 2.3
Code Example :
// You must already have a ServiceProvider object
var serviceProvider;
// Define the ServiceProvider deletion success callback
function sProviderDeleteCallback() {
console.log("The ASF service provider has been deleted properly.");
}
// Define the ServiceProvider deletion error callback
function eProviderDeleteCallback(error, state) {
console.log(error.name);
console.log("The current ASF service state: " + state);
}
// Try to delete the ServiceProvider object
try {
webapis.allshare.serviceconnector.deleteServiceProvider(sProviderDeleteCallback, eProviderDeleteCallback);
}
catch(e) {
console.log(e.message);
}
getServiceProvider
Returns a ServiceProvider object that is connected to the AllShare Framework.
ServiceProvider : ServiceProvider ServiceProvider object connected to the AllShare Framework
Exceptions :
WebAPIException
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
try {
// You must already have a ServiceProvider object
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
if (serviceProvider == null) {
console.log("Service provider was not created properly");
}
}
catch(e) {
console.log(e.message);
}
2.8 ServiceProvider
Provides methods for obtaining a DeviceFinder object.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
// You must already have a ServiceProvider object
var serviceProvider;
try {
serviceState = serviceProvider.getServiceState();
} catch(e) {
console.log(e.name);
}
2.9 DeviceDiscoveryCallback
Defines a generic callback for device discovery event notifications.
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var mediaProviderId; // The MEDIAPROVIDER's device ID is assumed to be known
try {
var deviceFinder = serviceProvider.getDeviceFinder();
// Get the MediaProvider device object
var device = deviceFinder.getDevice("MEDIAPROVIDER", mediaProviderId);
// Print the device ID
console.log(device.id);
} catch(e) {
console.log(e.name);
}
getDeviceList
Lists the discovered devices with a specific device type.
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider().
try {
var deviceFinder = serviceProvider.getDeviceFinder();
var devices = deviceFinder.getDeviceList("MEDIAPROVIDER");
// Print the number of available MediaProvider devices
console.log(devices.length);
} catch(e) {
console.log(e.name);
}
with error type SecurityError, if the application does not have the privilege to call this method
with error type UnknownError, for any other error.
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
try {
var deviceFinder = serviceProvider.getDeviceFinder();
var providers = deviceFinder.getDeviceList("MEDIAPROVIDER");
if (providers.length == 0) {
// Refresh the device list and retrieve the provider list again
deviceFinder.refresh();
providers = deviceFinder.getDeviceList("MEDIAPROVIDER");
}
} catch(e) {
console.log(e.name);
}
addDeviceDiscoveryListener
Registers a device discovery event listener.
long addDeviceDiscoveryListener(DeviceDiscoveryCallback deviceDiscoveryCallback);
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var listenerId; // Listener ID returned from addDeviceDiscoveryListener
var monitoringCB = {
ondeviceadded : function (device) { console.log("new device has appeared :" + device.name); },
ondeviceremoved : function (device) { console.log("a device has disappeared :" + device.name); }
}
try {
var listenerId = serviceProvider.getDeviceFinder().addDeviceDiscoveryListener(monitoringCB);
serviceProvider.getDeviceFinder().removeDeviceDiscoveryListener(listenerId);
} catch(e) {
console.log(e.name);
}
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type SecurityError, if the application does not have the privilege to call this method
with error type UnknownError, for any other error.
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var mediaProviderId; // The MEDIAPROVIDER's device ID is assumed to be known
var propertyName; // The MEDIAPROVIDER's propertyname is assumed to be known
try {
var deviceFinder = serviceProvider.getDeviceFinder();
// Get the MediaProvider device object
var device = deviceFinder.getDevice("MEDIAPROVIDER", mediaProviderId);
var propertyData = deviceFinder.getProperty(propertyName , device);
console.log(propertyData)
} catch(e) {
console.log(e.name);
}
itemList : Item list. If there are no items, an empty list is returned.
endOfItems : End of items flag
providerId : Provider device identifier
Code Example :
//onsuccess searchCB
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var keyword = "foo";
// Define a browse callback
function searchCB(list, endOfItem, providerId){
// Retrieve the item list
}
function errorCB(error, device){
console.log(device + " raises " + error);
}
// Define a filter to browse videos only
var filter = new webapis.AttributeFilter("itemType", null, {"VIDEO"});
try {
var providers = serviceProvider.getDeviceFinder().getDeviceList("MEDIAPROVIDER");
if (providers.length > 0) {
// Search for the keyword in the first DMS
providers[0].search(keyword, 0, 40, searchCB, errorCB, filter);
}
} catch(e) {
console.log(e.message);
}
2.14 MediaProviderErrorCallback
Defines a generic error callback for provider-related operations.
error : Object indicating the error type and message
providerId : Provider device identifier
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method
Code Example :
//onerror errorCB
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var keyword = "foo";
// Define a browse callback
function searchCB(list, endOfItem, providerId){
// Retrieve the item list
}
function errorCB(error, device){
console.log(device + " raises " + error);
}
// Define a filter to browse videos only
var filter = new webapis.AttributeFilter("itemType", null, {"VIDEO"});
try {
var providers = serviceProvider.getDeviceFinder().getDeviceList("MEDIAPROVIDER");
if (providers.length > 0) {
// Search for the keyword in the first DMS
providers[0].search(keyword, 0, 40, searchCB, errorCB, filter);
}
} catch(e) {
console.log(e.message);
}
browseCallback : Callback invoked when the browse operation is successful. It returns a set of items matching the filter.
errorCallback[optional][nullable] : Generic error callback for provider-related operations
browseFilter[optional][nullable] : Browse filter to be applied. Parameters can include AttributeFilter objects constructed with ("itemType", null , ItemType[]).
sortMode[optional][nullable] : Sorting to use on the content list. Sorting by title, date, artist, or albumTitle attribute is only supported on the Tizen Web platform. Other Web platforms ignore this parameter.
Exceptions :
WebAPIException
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
// Define a browse callback
function browseCB(list, endOfItem, providerId) {
// Retrieve the item list
}
function errorCB(error, deviceId) {
console.log(error.message);
}
// Define a filter to browse videos only
var filter = new webapis.AttributeFilter("itemType", null, {"VIDEO"});
// Define a sort mode
var mode = new webapis.SortMode("title", "ASC");
try {
var providers = serviceProvider.getDeviceFinder().getDeviceList("MEDIAPROVIDER");
if (providers.length > 0) {
// Retrieves the first DMS from the root folder
providers[0].browse(providers[0].rootFolder, 0, 10, browseCB, errorCB, filter, mode);
}
} catch(e) {
console.log(e.message);
}
search
Searches content for a specific keyword.
void search(DOMString keyword, unsigned long startIndex, unsigned long requestCount, MediaProviderSuccessCallback successCallback, optional MediaProviderErrorCallback? errorCallback, optional AbstractFilter? searchFilter);
successCallback : Callback to invoke when the search operation is successful. It returns a set of items matching the filter.
errorCallback[optional][nullable] : Generic error callback for provider-related operations
searchFilter[optional][nullable] : Filter applied to the search result. Parameters can include AttributeFilter objects constructed with ("itemType", null , ItemType[]).
Exceptions :
WebAPIException
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
with error type UnknownError, for any other error.
with error type SecurityError, if the application does not have the privilege to call this method
Since : 2.3
Code Example :
var serviceProvider = webapis.allshare.serviceconnector.getServiceProvider();
var keyword = "foo";
// Define a browse callback
function searchCB(list, endOfItem, providerId){
// Retrieve the item list
}
function errorCB(error, device){
console.log(device + " raises " + error);
}
// Define a filter to browse videos only
var filter = new webapis.AttributeFilter("itemType", null, {"VIDEO"});
try {
var providers = serviceProvider.getDeviceFinder().getDeviceList("MEDIAPROVIDER");
if (providers.length > 0) {
// Search for the keyword in the first DMS
providers[0].search(keyword, 0, 40, searchCB, errorCB, filter);
}
} catch(e) {
console.log(e.message);
}
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.