Hugo
Hugo

Reputation: 994

Filtered google cast device scan yields nothing (iOS)

If I launch the device scanner without a filter the chromecast device is located & everything is well.

If I launch the device scanner filtered for my app, my understanding is that the chromecast device running the app should be detected. But the device scan yields nothing (or at least the deviceDidComeOnline delegate method is never called).

At the time of the test my receiver is up and running on the TV (the receiver app supports the standard media channel plus another ad-hoc channel with the namespace urn:x-cast:com.mycompany.mychannel)

What am I doing wrong?

    // _filteredScanner and _filter are both 'strong' attributes of the class
    - (id) init {
      self = [super init];
      if (self != nil) {
        _filteredScanner = [[GCKDeviceScanner alloc] init] ;
        GCKFilterCriteria *myappRunningCriteria = [GCKFilterCriteria         criteriaForRunningApplicationWithID:nil supportedNamespaces:@[@"urn:x-cast:com.mycompany.mychannel", @"urn:x-cast:com.google.cast.media"]];
        _filter = [[GCKDeviceFilter alloc] initWithDeviceScanner: _filteredScanner criteria: myappRunningCriteria] ;
        [_filter addDeviceFilterListener:self];
        [_filteredScanner startScan] ;
      }
      return self ;
    }


    #pragma mark - GCKDeviceFilterListener
    - (void)deviceDidComeOnline:(GCKDevice *)device forDeviceFilter: (GCKDeviceFilter*)filter {
      NSLog(@"OK Device scanner filter found new device: %@", device.friendlyName);
    }

    - (void)deviceDidGoOffline:(GCKDevice *)device forDeviceFilter: (GCKDeviceFilter*) filter{
      NSLog(@"OK Device scanner filter reported device offline: %@", device.friendlyName);
    }

Upvotes: 1

Views: 467

Answers (1)

Hugo
Hugo

Reputation: 994

Seems like this was a bug in the google Cast iOS SDK v2.3.0 that was just fixed in v2.4.0 (see the bug report)

Upvotes: 0

Related Questions