top

MEDIASHARING.MEDIAPROVIDERFINDER

This class provides a list of available media providers that are searched and can check whether the media provider is discovered or not.

Add the following line for mediasharing.mediaproviderfinder class into a html file your own :

  script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/serviceapis.js">/script>

You can declare mediasharing.mediaproviderfinder class like this :

  ex) var mediasharing = serviceapis.mediasharing.mediaproviderfinder;


Methods

getMediaProviders

Description
Provides the list of discovered providers
Parameters
none
Return■Array
  - discovered media providers
Emulator SupportY
SDK ConstraintNone
Example
var providerArray = serviceapis.mediasharing.mediaproviderfinder.getMediaProviders();
//if there no provider device
if (providerArray.length <= 0) {
    document.write("No media provider device around here");
} else {
    for (i = 0; i < providerArray.length; i++) {
        document.write(providerArray[i].getName());
    }
}

setMediaProviderFinderCallback

Description
register a provider discovery event listener
Parameters
■providerCB
  - Function
Return■Void
Emulator SupportY
SDK ConstraintNone
Example
var providerCB = {
    onmediaprovideradded: function (provider) {
        document.write("A device is newly discovered! Its name is " + provider.getName());
    },
    onmediaproviderremoved: function (provider) {
      document.write("A device was gone! Its name was " + provider.getName());
    }
};
// register a callback for monitoring device discovery
serviceapis.mediasharing.mediaproviderfinder.setMediaProviderFinderCallback(providerCB);