Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid argument(s): "<" expected at 1:1 #2

Closed
holyspidoo opened this issue Dec 19, 2018 · 6 comments
Closed

Invalid argument(s): "<" expected at 1:1 #2

holyspidoo opened this issue Dec 19, 2018 · 6 comments

Comments

@holyspidoo
Copy link

Trying to use this library but having an issue when trying to get a CastDevice

CastDevice device = CastDevice(name:info.name,host: info.address,port:info.port,type: '_googlecast._tcp');

This gives me the error:

Invalid argument(s): "<" expected at 1:1
#0      parse (package:xml/xml.dart:43:5)
#1      new CastDevice.<anonymous closure> (package:dart_chromecast/casting/cast_device.dart:33:36)
#2      _RootZone.runUnary (dart:async/zone.dart:1379:54)
#3      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#4      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#5      Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#6      Future._complete (dart:async/future_impl.dart:476:7)
#7      _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#8      _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
#9      _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:295:13)
#10     _withClient (package:http/http.dart)
<asynchronous suspension>
#11     get (package:http/http.dart:46:5)

Any ideas?

@NBTX
Copy link

NBTX commented Dec 19, 2018

In order to get information about your device, the library makes an HTTP GET request to http://${host}:8008/ssdp/device-desc.xml. The result you're getting is an invalid response.

I recommend printing info.address and then making the GET request in your browser, substituting the printed address into the above URL. If you still can't determine the cause of the issue, I recommend you post the response here.

@holyspidoo
Copy link
Author

From the browser, I can easily get info from /setup/eureka_info but never from /ssdp/device-desc.xml

@NBTX
Copy link

NBTX commented Dec 20, 2018

Okay I've done some digging and found some unofficial documentation (https://rithvikvibhu.github.io/GHLocalApi/#device-info-eureka-info-get) - it looks like the library can be adapted to use /setup/eureka_info (which works on my Android TV device too - out of interest are you using an Android TV or Chromecast?)

For reference, the URL I've crafted that can act as a substitute is: http://${host}:8008/setup/eureka_info?params=name,version,detail.icon_list,device_info.manufacturer,device_info.model_name

I'll try and sort out a PR to the repo. Not sure how active the maintainer is.

@terrabythia
Copy link
Owner

Didn't know about the eureka_info way to get the device's info. Seems to be a better fit for this use case, since it's JSON and not (annoying) XML and we can also specify which params we would like to have returned.

Updated the code to use eureka_info instead of device_info.

@holyspidoo
Copy link
Author

For model name and friendly name, there is no need for eureka_info since we already have the attributes bundle to decode? You can look at how I did it in:
cast_device

@holyspidoo
Copy link
Author

Also, just a heads up, I've noticed that POST requests to Eureka device dont' seem to work with HTTP library, I had to use DIO to get those to work (for GET it doesn't matter). Took me far too much time to find out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants