chromecast-java-api-v2
chromecast-java-api-v2 copied to clipboard
Unable to discover any chromecast devices
Hi, I am unable to search any my chomecast devices using the below code. However, i checked using the pychromecast just to verify and it is able to search the chromecast in my network. What could be the issue ?
public static void main(String[] args) {
try {
System.out.println("Searching for ChromeCasts...");
ChromeCasts.startDiscovery();
// Wait for CC:s to appear
Thread.sleep(10000);
System.out.println("Done searching");
for (ChromeCast cc : ChromeCasts.get())
System.out.println(cc.getName());
System.out.println("Done searching finally");
} catch (Exception e) {
e.printStackTrace();
}
}
Logs
16:54:46.462 [main] DEBUG javax.jmdns.impl.JmDNSImpl - JmDNS instance created
16:54:51.956 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:51.969 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:51.972 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:51.974 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@1197599965 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:51.975 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:51.975 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@824339293 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:52.186 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:52.187 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:52.187 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@2037214880 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:52.197 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:52.197 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:52.197 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@1150454254 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:52.413 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:52.414 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:52.414 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@302815634 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:52.423 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).Timer] DEBUG javax.jmdns.impl.tasks.resolver.DNSResolverTask - ServiceResolver(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS querying service
16:54:52.423 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:0 additionals:0
16:54:52.423 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=40, id=0x0, questions=1
questions:
[Pointer@810967053 type: TYPE_PTR index 12, class: CLASS_IN index 1, name: _googlecast._tcp.local.]]
16:54:52.727 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.
16:54:52.730 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing #probing 1
16:54:52.731 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:1 additionals:0
16:54:52.732 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=87, id=0x0, questions=1, authorities=1
questions:
[AllRecords@576458953 type: TYPE_ANY index 255, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.]
authorities:
[IPv6Address@1917923477 type: TYPE_AAAA index 28, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3600/3600' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']]
16:54:53.730 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.
16:54:53.731 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing #probing 2
16:54:53.732 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:1 additionals:0
16:54:53.733 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=87, id=0x0, questions=1, authorities=1
questions:
[AllRecords@1160391594 type: TYPE_ANY index 255, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.]
authorities:
[IPv6Address@1048870402 type: TYPE_AAAA index 28, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3599/3600' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']]
16:54:54.734 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.
16:54:54.735 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Prober(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS probing #probing 3
16:54:54.748 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:1 answers:0 authorities:1 additionals:0
16:54:54.749 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle query: dns[query,fe80:0:0:0:58fb:81ff:fe46:61b2%11:5353, length=87, id=0x0, questions=1, authorities=1
questions:
[AllRecords@98726737 type: TYPE_ANY index 255, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.]
authorities:
[IPv6Address@386682481 type: TYPE_AAAA index 28, class: CLASS_IN index 1, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3600/3600' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']]
16:54:55.737 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Announcer(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS announcing fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.
16:54:55.737 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Announcer(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS announcing #announcing 1
16:54:55.738 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:0 answers:1 authorities:0 additionals:0
16:54:55.739 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle response: [IPv6Address@141089338 type: TYPE_AAAA index 28, class: CLASS_IN index 1-unique, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3598/3599' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']
16:54:55.739 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle response cached record: null
16:54:56.741 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Announcer(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS announcing fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.
16:54:56.741 [JmDNS(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).State.Timer] DEBUG javax.jmdns.impl.tasks.state.DNSStateTask - Announcer(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.).run() JmDNS announcing #announcing 2
16:54:56.741 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.DNSIncoming - DNSIncoming() questions:0 answers:1 authorities:0 additionals:0
16:54:56.742 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle response: [IPv6Address@2111992448 type: TYPE_AAAA index 28, class: CLASS_IN index 1-unique, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3600/3600' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']
16:54:56.742 [SocketListener(fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local.)] DEBUG javax.jmdns.impl.JmDNSImpl - fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. handle response cached record: [IPv6Address@141089338 type: TYPE_AAAA index 28, class: CLASS_IN index 1-unique, name: fe80-0-0-0-58fb-81ff-fe46-61b2-llw0.local. ttl: '3597/3599' address: 'fe80:0:0:0:58fb:81ff:fe46:61b2']
I think you have multiple network interfaces on your machine. By default the JmDNS (library for discovery) is using one of the interfaces, which may not be on the same network as your chromecast device. I suggest to specifying the IP address of network interface from the chromecast's network explicitly in the startDiscovery
method.
re: "I suggest to specifying the IP address of network interface from the chromecast's network explicitly in the startDiscovery
method."
This is most helpful. I was getting no Chromecast devices detected. I then passed the phone's WiFi interface's IP address to the startDiscovery
function and voila!
I am also having this issue, tried everything (except for debugging the internals of this library), to no avail. I'm not sure if I should keep trying, or is this library simply dead and obsolete? The last commit is over 2 years old, so I guess there must have been lots of backwards-incompatible changes in the Google APIs.
This library is still working fine for me. Start discovering devices, specifying the interface's IP address. Wait some time to pass (e.g. do other tasks) before checking to see what devices have been found.