Jump to content

question about client post to mediabrowser/sessions/capabilities


dheiskell

Recommended Posts

dheiskell

what is the proper format for the post for setting a devices capabilities to the server?

swagger urlencodes some of the info and doesn't appear to be correct it doesn't even send the sessionid?

 

here is what I assume the POST filename should be /mediabrowser/sessions/capabilities?format=json

 

and this is an example json message in the post body is this correct? If not please be specific as to what the filename and the body of the post message should look like! Thanks.

 

{
        "SupportedCommands": [],
        "QueueableMediaTypes": [],
        "PlayableMediaTypes": [
            "Audio",
            "Book",
            "Game",
            "Photo",
            "Video"
        ],
        "Id": "a3b1b3ab031d4b3aa638f9c90881306d",
        "UserId": "cda350792d5539b21f60cb845934ead3",
        "UserName": "Don",
        "AdditionalUsers": [],
        "ApplicationVersion": "1.0",
        "Client": "Monaco",
        "LastActivityDate": "2014-08-15T16:12:24.1113626Z",
        "DeviceName": "XP",
        "DeviceId": "XP",
        "SupportsRemoteControl": false,
        "PlayState": {
            "CanSeek": false,
            "IsPaused": false,
            "IsMuted": false
        }
    }

Link to comment
Share on other sites

The reason Session Id shows up in Swagger for that method is because it's a shared object with other methods. You don't need to specify it. Most clients don't keep a hold of their server-side session id, so we evolved this so that it wasn't needed. Instead just make sure the authentication headers are supplied:

 

https://github.com/MediaBrowser/MediaBrowser/wiki/Authentication

 

So that means that you won't be able to use swagger to test this method.

 

What is this for, curiously?

Link to comment
Share on other sites

dheiskell

I am writing a client for interfacing to a Dune media player. The client is inside of a home automation controller. And will act as a proxy so other media browser clients can play/control playback of the dune.

I have another question that I didn't see in any api doc, what resolution are mediabrowsers ticks, i.e. how many ticks per second?

 

I used wireshark from media browser theater  to capture what is required to set capabilities for a device. Hopefully the next guy won't have to do this.  I notice that the post sends the capabilities in the url and in the body? Also the X-MediaBrowser-Token from authentication  is not in the header, i added it in mine and it works, you must not be tightly checking reqests for authentication?

 

POST /mediabrowser/Sessions/Capabilities?PlayableMediaTypes=Audio,Video,Game,Photo,Book&SupportedCommands=MoveUp,MoveDown,MoveLeft,MoveRight,PageUp,PageDown,PreviousLetter,NextLetter,ToggleOsd,ToggleContextMenu,Select,Back,TakeScreenshot,SendKey,SendString,GoHome,GoToSettings,VolumeUp,VolumeDown,Mute,Unmute,ToggleMute,SetVolume,SetAudioStreamIndex,SetSubtitleStreamIndex,ToggleFullscreen,DisplayContent,GoToSearch,DisplayMessage&format=json HTTP/1.1
Authorization: MediaBrowser Client="Media Browser Theater", DeviceId="DONSHPLAPTOP", Device="DONSHPLAPTOP", Version="3.0.5340.39397"
Content-Type: application/x-www-form-urlencoded
Host: don-ivyserver:8096
Content-Length: 389
Accept-Encoding: deflate

PlayableMediaTypes=Audio,Video,Game,Photo,Book&SupportedCommands=MoveUp,MoveDown,MoveLeft,MoveRight,PageUp,PageDown,PreviousLetter,NextLetter,ToggleOsd,ToggleContextMenu,Select,Back,TakeScreenshot,SendKey,SendString,GoHome,GoToSettings,VolumeUp,VolumeDown,Mute,Unmute,ToggleMute,SetVolume,SetAudioStreamIndex,SetSubtitleStreamIndex,ToggleFullscreen,DisplayContent,GoToSearch,DisplayMessage
 

Link to comment
Share on other sites

Just a side note but your device ID should be something unique to the device as opposed to just a user-entered name.  On PCs I use the mac address.

 

And the authentication "switch" hasn't been thrown yet because all clients need to implement it first.

Link to comment
Share on other sites

dheiskell

the deviceid in the post i captured is from mediabrowser theater, they are using the pc's name. Does the deviceid need to be the same from session to session, i assume not, but it needs to be unique correct?

Link to comment
Share on other sites

see if you can do something better than computer name. MBT needs to be updated in that regard.

 

1 tick = 10000 ms

Link to comment
Share on other sites

the deviceid in the post i captured is from mediabrowser theater, they are using the pc's name. Does the deviceid need to be the same from session to session, i assume not, but it needs to be unique correct?

 

It should be consistent for the device.  As in, something that truly identifies that particular device as opposed to a randomly generated identifier.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...