dalton5 1 Posted January 4, 2018 Share Posted January 4, 2018 Hi, I have an issue to authenticate on EmbyServer with EMby Api Client. I do: ApiClient client = new ApiClient(logger, Settings.Default.EmbyUrl, "myapikey", cryptoProvider); I always have device which is null and an exception is raised. After investigation it seems to come from BaseApiClient protected string AuthorizationParameter { get { if (string.IsNullOrEmpty(ClientName) && string.IsNullOrEmpty(DeviceId) && string.IsNullOrEmpty(DeviceName)) { return string.Empty; } It tests DeviceId but it points to Properties Device.DeviceId and device is null and never set. /// <summary> /// Gets or sets the device id. /// </summary> /// <value>The device id.</value> public string DeviceId { get { return Device.DeviceId; } } WHat am I doing wrong? Is it a bug? Thanks, Link to comment Share on other sites More sharing options...
Luke 37994 Posted January 4, 2018 Share Posted January 4, 2018 It should have another constructor you can use to pass a device in. Link to comment Share on other sites More sharing options...
dalton5 1 Posted January 4, 2018 Author Share Posted January 4, 2018 Ok thanks. Where can I find the détails of the devices? In my emby admin device page it's blank. And in swagger I have the error, TypeError: Failed to fetch Thanks, Link to comment Share on other sites More sharing options...
Luke 37994 Posted January 4, 2018 Share Posted January 4, 2018 I assume you're using the c# apiclient: https://github.com/MediaBrowser/Emby.ApiClient/blob/master/Emby.ApiClient/ApiClient.cs#L108 It is also discussed on the readme: https://github.com/MediaBrowser/Emby.ApiClient Link to comment Share on other sites More sharing options...
dalton5 1 Posted January 7, 2018 Author Share Posted January 7, 2018 (edited) Yes. Thanks. I am using the c# api. FYI, the documentation is a little old and it's quite difficult to understand how everything is working. But I would like to be able to receive all playback events from all the devices connected to my server. How can I do that easily? I do not want to select one device connected but all. I thought it was possible by using the apikey token but it seems to be buggy.. Thanks, Edited January 7, 2018 by dalton5 Link to comment Share on other sites More sharing options...
Luke 37994 Posted January 7, 2018 Share Posted January 7, 2018 Everything we've talked about up to this point is just about getting the library loaded and connecting to the server. None of what I've said will prevent you from doing what you want to do. Link to comment Share on other sites More sharing options...
dalton5 1 Posted January 7, 2018 Author Share Posted January 7, 2018 Ok. So is there an example on how to do this? I have followed the instructions on API client .net github page and opened the web socket and when I am trying to raise the playback event nothing is raised. Thanks Envoyé de mon iPhone en utilisant Tapatalk Link to comment Share on other sites More sharing options...
Luke 37994 Posted January 7, 2018 Share Posted January 7, 2018 So you're able to use the basic functions of the library? Link to comment Share on other sites More sharing options...
dalton5 1 Posted January 7, 2018 Author Share Posted January 7, 2018 Yes and i CAN connect but i can't get events raised every time a playback command is sent to the server Envoyé de mon iPhone en utilisant Tapatalk Link to comment Share on other sites More sharing options...
dalton5 1 Posted January 8, 2018 Author Share Posted January 8, 2018 (edited) Ok finally found the issue. It's in the .net API. The response json arrives not full. I had to fix some stuff. And now the playbackstart event is raised. Thanks for your help! The fix: string jsonFull = ""; /// <summary> /// Called when [message received]. /// </summary> /// <param name="bytes">The bytes.</param> protected void OnMessageReceived(byte[] bytes) { var json = Encoding.UTF8.GetString(bytes, 0, bytes.Length); try { if (json.StartsWith("{\"MessageType")) jsonFull = json.Replace("\0", string.Empty); else jsonFull = jsonFull + json.Replace("\0", string.Empty); JsonSerializer.DeserializeFromString<WebSocketMessage>(jsonFull); OnMessageReceived(jsonFull); } catch { } } Edited January 8, 2018 by dalton5 Link to comment Share on other sites More sharing options...
Luke 37994 Posted July 6, 2018 Share Posted July 6, 2018 Swagger params are finally back and better then ever: https://emby.media/community/index.php?/topic/60520-34127-swagger-params/ Enjoy. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now