Jump to content

Media browser theater websocket corrupting data


dheiskell

Recommended Posts

dheiskell

I captured the following set of web socket communications using wireshark. This was done so I could understand exactly what was being sent back and forth to start playing a audio file and then stop playing the file.

 

I noticed that media browser theater appears to be sprinkling in \'s in it's unmasked text. The following was copied from wireshark and illustrates the potential problem! I guess it's possible wireshark did this, but the \ is only inserted in the masked messages coming from mbt! If it helps reproduce the problem I was using a browser interface to command the playback to start and stop in mbt.

 

1625 server to client
    {"MessageType":"Play","Data":{"ItemIds":["e83c5094323a8face34718034afff1a5"],"PlayCommand":"PlayNow","ControllingUserId":"cda350792d5539b21f60cb845934ead3"}}
1939 client to server
    {"MessageType":"ReportPlaybackStart","Data":"{\"QueueableMediaTypes\":[\"Audio\"],\"CanSeek\":true,\"ItemId\":\"e83c5094323a8face34718034afff1a5\",\"IsPaused\":false,\"IsMuted\":false,\"PlayMethod\":\"DirectPlay\"}"}

2552 client to server
    {"MessageType":"ReportPlaybackProgress","Data":"{\"CanSeek\":true,\"ItemId\":\"e83c5094323a8face34718034afff1a5\",\"AudioStreamIndex\":0,\"IsPaused\":false,\"IsMuted\":false,\"PositionTicks\":72878958,\"VolumeLevel\":82,\"PlayMethod\":\"DirectPlay\"}"}
2554 websocket server sending playstate stop
{"MessageType":"Playstate","Data":{"Command":"Stop","ControllingUserId":"cda350792d5539b21f60cb845934ead3"}}
2555 websockect client reporting playback stopped
    {"MessageType":"ReportPlaybackStopped","Data":"{\"ItemId\":\"e83c5094323a8face34718034afff1a5\",\"PositionTicks\":79361112}"}
2556 websocket server
    {"MessageType":"PlaybackStopped","Data":{"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"],"QueueableMediaTypes":["Audio"],"PlayableMediaTypes":["Audio","Video","Game","Photo","Book"],"Id":"0d42b24ddd094de5b7f0b1b2bd592309","UserId":"cda350792d5539b21f60cb845934ead3","UserName":"Don","AdditionalUsers":[],"ApplicationVersion":"3.0.5345.17016","Client":"Media Browser Theater","LastActivityDate":"2014-08-25T15:53:05.0276405Z","NowViewingItem":{"Name":"Media Folders","Id":"1d9c646355383f9be560060f42d12a3d","Type":"UserRootFolder","Artists":[],"MediaStreams":[],"Chapters":[]},"DeviceName":"DONSHPLAPTOP","DeviceId":"DONSHPLAPTOP","SupportsRemoteControl":true,
2558 websocket server continuation
    "PlayState":{"CanSeek":false,"IsPaused":false,"IsMuted":false}}}
2560 websocket server
    {"MessageType":"UserDataChanged","Data":{"UserId":"cda350792d5539b21f60cb845934ead3","UserDataList":[{"PlayedPercentage":0,"PlaybackPositionTicks":0,"PlayCount":4,"IsFavorite":false,"LastPlayedDate":"2014-08-25T15:52:57.6676302Z","Played":true,"Key":"e83c5094-323a-8fac-e347-18034afff1a5"},{"PlayedPercentage":100,"UnplayedItemCount":0,"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":true,"Key":"6e22ddec-2fa2-6b0f-a670-6c0c6f098502"}]}}
 

Link to comment
Share on other sites

dheiskell

Luke, I discovered that you MUST put the \'s in front of every " for the server to respond properly to ReportPlaybackStart,ReportPlaybackProgress,ReportPlaybackStopped websocket messages!

 

I am not a json expert but that doesn not look properly  formatted to me. Is that correct?

I assume their is a bug in the json parser in the server, which is why media browser theater did this?

 

Because I had to put in the \'s if you ever fix this then probably my client and others will also have to be fixed?

 

Just so I know does this extra \ before every " apply to any json messages sent to the server, or just these three?

 

And no I wasn't looking for a problem, but I obviously found one and was just trying to be helpful.

 

Anyone else who writes a client NOT based on your C# classes is going to run into this same problem!

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...