Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request

Post Reply
rcrawley
Posts: 13
Joined: Sat Aug 25, 2018 5:06 am

Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request

Post by rcrawley »

I'm experimenting with streaming My Media content to my iPhone via the Alexa app and seeing some weird behavior. I've opened up a port in my firewall for TCP port 52050 and created a NAT rule on the router which points from my public IP to the laptop running MyMedia on port 52050, and I've enabled "Enable via Firewall NAT" in the MyMedia GUI. When I ask the iPhone Alexa app to play something, like "Ask MyMedia to the song back in black" the app correctly comes back with "Playing the track Back In Black from you My Media collection". The My Media dashboard, however, reports the following error:

Alexa reported an error streaming the track Back In Black - MEDIA_ERROR_INVALID_REQUEST. If this happens on every track...

The error code was: MEDIA_ERROR_INVALID_REQUEST
The detailed message was: Invalid format.

And here are a few snippets from the log files (I've pruned just for example):

Code: Select all

12/11/2018 17:17:48.529 14157:0 81 ServiceAgent.cs:CreatePlaylist:2648 Exact match to input found, taking this result
12/11/2018 17:17:48.532 14157:0 21 PushClient.cs:Ws_OnMessage:283 Sending response: {"ResponseCode":200,"Playlist":{"ID":"7c1f8170-e4b8-4702-a0ae-8d3e5777ece1","MediaClientID":"abcdef1-1b4e-4a5b-8869-1ec75c25f7ce","Name":"the track Back In Black","Shuffle":false,"Loop":false,"Temporary":true,"CreateDate":"2018-11-12T
12/11/2018 17:17:49.087 14157:0 18 PushClient.cs:Ws_OnMessage:442 Preloading /AC_DC/Back In Black/03 Back In Black.mp3
12/11/2018 17:17:49.097 14157:0 146 ServiceAgent.cs:PreloadFile:2192 File opened successfully.
12/11/2018 17:17:55.993 14157:0 18 PushClient.cs:Ws_OnMessage:403 PlaylistItem request was for : PlaylistId:7c1f8170-e4b8-4702-a0ae-8d3e5777ece1, PreviousMedaiItemId:2a2beb1c-4013-471b-9585-f1b5565bf466, TrackRequest:NextTrack
12/11/2018 17:17:55.996 14157:0 18 ServiceAgent.cs:GetPlaylistMediaItem:2101 Next track - Got to the end of the playlist, looping is off and no more tracks, returning null
12/11/2018 17:17:55.999 14157:0 18 PushClient.cs:Ws_OnMessage:506 Sending response: {"ResponseCode":404,"PlaylistMediaItem":{"ID":"00000000-0000-0000-0000-000000000000","PlaylistID":"00000000-0000-0000-0000-000000000000","MediaItemID":"00000000-0000-0000-0000-000000000000","PlayOrder":0,"PlayOrderRandom":0,"Offset":0},"MediaItem":{"ID":"00000000-0000-0000-0000-000000000000","MediaClientID":"00000000-0000-0000-0000-000000000000","CheckSum":null,"FileName":null,"PlayCount":0,"Rating":0,"Title":null,"ContributingArtists":null,"AlbumArtist":null,"Album":null,"Year":0,"DiscNumber":0,"TrackNumber":0,"TrackCount":0,"Genre":null,"Composer":null,"Tag":null,"SourceID":null,"SourceName":null,"Indexed":"0001-01-01T00:00:00Z","Codec":"","Duration":0,"Hidden":false,"IsAudioBook":false,"GroupID":"00000000-0000-0000-0000-000000000000"},"SmallImage":null,"LargeImage":null,"MessageType":4,"Locale":"en-US","TransactionID":"abcdef1-8503-4735-9f8c-cad4486b1fd2"}
12/11/2018 17:17:56.334 14157:0 10 PushClient.cs:Ws_OnMessage:237 Received message: {"DeviceID":"amzn1.ask.device.AEAPX6Z6VZCJL.....<STRIPPED_STRING>","PlaylistID":"7c1f8170-e4b8-4702-a0ae-8d3e5777ece1","MediaItemID":"7e908afb-96aa-43c6-8ccf-8c443a528c2a","MediaPlaylistItemID":"2a2beb1c-4013-471b-9585-f1b5565bf466","Offset":0,"ErrorCode":"MEDIA_ERROR_INVALID_REQUEST","ErrorMessage":"Invalid format","NotifyType":4,"MessageType":9,"Locale":"en-US","TransactionID":"24304f11-f6aa-4a3a-bcb2-99f8e2c5b17f"}
12/11/2018 17:17:56.339 14157:0 10 MessageController.cs:AddMessage:114 Added 8a4f9d1c-bca3-4570-ad7a-941ad7c9bd37; Title:Alexa reported an error streaming the track Back In Black - MEDIA_ERROR_INVALID_REQUEST.  If this happens on every track, please check your computer firewall settings or <a href='/index.html#!/faq'>review our FAQ</a>.; Description:Your Alexa device reported an error streaming the current track (/AC_DC/Back In Black/03 Back In Black.mp3).
It happens on any track I test via the Alexa app on my iPhone and a track in any format (even if transcoding of non-MP3s is successful). All tracks play fine via the Echo on my home network, no issues. I'm wondering if in the above if the issue has to do with MediaItem and Client IDs being all zeros?

To further diagnose, when I manually attempt to connect to My Media remotely from a terminal with curl and nc then I can see successful connection attempts, see below for details, so it looks like both my firewall and NAT are working correctly.

Code: Select all

---
$ curl -sI http://mymedia.server:52050/
HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Mono-HTTPAPI/1.0
Date: Mon, 12 Nov 2018 05:32:56 GMT
Content-Length: 0
Keep-Alive: timeout=15,max=100
---

---
$ nc mymedia.server 52050
HEAD

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Mon, 12 Nov 2018 05:33:28 GMT
Content-Length: 52
Connection: close

<h1>Bad Request (Invalid request line (parts).)</h1>
---

---
Output of MyMediaForAlexa.log during a successful curl request from outside
my network: 

12/11/2018 17:34:35.785 14157:0 146 WebServer.cs:AuthenticationSchemeForClient:1086 Client authentication protocol selection in progress...http://mymedia.server:52050/
12/11/2018 17:34:35.786 14157:0 146 WebServer.cs:AuthenticationSchemeForClient:1091 Anonymous
12/11/2018 17:34:35.788 14157:0 07 WebServer.cs:AuthenticationSchemeForClient:1086 Client authentication protocol selection in progress...http://mymedia.server:52050/
12/11/2018 17:34:35.788 14157:0 07 WebServer.cs:AuthenticationSchemeForClient:1091 Anonymous
12/11/2018 17:34:35.789 14157:0 10 WebServer.cs:DoRequest:214 CurrentRequests Count = 2
12/11/2018 17:34:35.790 14157:0 10 WebServer.cs:DoRequest:238 WebRequest:1397 from 140.XXX.XXX.XXX, START WebServer::HTTP Request - HEAD url=http://mymedia.server:52050/ useragent=curl/7.54.0 headers=Host: mymedia.server:52050
User-Agent: curl/7.54.0
Accept: */*


12/11/2018 17:34:35.790 14157:0 10 WebServer.cs:DoRequest:249 WebRequest: invalid port web console request
12/11/2018 17:34:35.791 14157:0 10 WebServer.cs:DoRequest:982 WebRequest:1397 Closing stream.
12/11/2018 17:34:35.792 14157:0 10 WebServer.cs:DoRequest:1002 WebRequest:1397 Closed.
---
When I look at the full logs I'm seeing that everything else looks good (including successful transcoding of non-MP3s to TranscodeCache). So I'm somewhat stuck on figuring out why My Media is throwing up the MEDIA_ERROR_INVALID_REQUEST error and not streaming through the Alexa app on my iPhone. Thoughts? Anything else I can test?

Thanks!
rcrawley
Posts: 13
Joined: Sat Aug 25, 2018 5:06 am

Re: Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request

Post by rcrawley »

I just tested the new(?) features to "Enable via Push" to stream through MyMedia cloud servers but the latest version (1.3.106.0) is still reporting the same errors when trying to ask MyMedia to stream to the Alexa app on my iPhone:

Code: Select all

02/12/2018 14:33:38.217 10774:0 15 MessageController.cs:AddMessage:114 Added 58c4ec3c-c419-46ae-abe2-b868fff1ed83; Title:Alexa reported an error streaming the track Machine Gun - MEDIA_ERROR_INVALID_REQUEST.  If this happens on every track, please check your computer firewall settings or <a href='/index.html#!/faq'>review our FAQ</a>.; Description:Your Alexa device reported an error streaming the current track (/Portishead/Third/08 Machine Gun.m4a).

The error code was: MEDIA_ERROR_INVALID_REQUEST
The detailed message was: Invalid format.

If this happens on every track, please check your computer firewall settings or <a href='/index.html#!/faq'>review our FAQ</a>.
And then eventually the Alexa iPhone app starts reporting that MyMedia server is not online or connected to the internet.

Do you guys have any documentation on how to test streaming outside your network and getting everything working?

Thanks!
bizmodeller
Posts: 458
Joined: Thu Nov 14, 2013 8:40 pm

Re: Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request

Post by bizmodeller »

Hmm .... we've just retested and MP3s are streaming fine whereas M4A tracks (which play on the Echo devices) aren't and are giving the same error below.

However, I note you are seeing it with MP3s and M4As - what bitrate are your MP3s?
rcrawley
Posts: 13
Joined: Sat Aug 25, 2018 5:06 am

Re: Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request

Post by rcrawley »

Looks like FFMpeg is transcoding to 256 kb/s. Here are dumps of mediainfo for the original M4A and the transcoded MP3:

Code: Select all

General
Complete name                            : /Music/Yes/Yessongs/1-08 Roundabout.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (M4A /mp42/isom)
File size                                : 62.9 MiB
Duration                                 : 8 min 29 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 034 kb/s
Album                                    : Yessongs
Album/Performer                          : Yes
Part/Position                            : 1
Part/Total                               : 2
Track name                               : Roundabout
Track name/Position                      : 8
Track name/Total                         : 8
Performer                                : Yes
Genre                                    : Progressive Rock
Recorded date                            : 1973
Encoded date                             : UTC 2017-07-24 15:16:30
Tagged date                              : UTC 2017-07-24 15:16:30
Writing application                      : X Lossless Decoder 20170710, QuickTime 7.7.3
Cover                                    : Yes

Audio
ID                                       : 1
Format                                   : ALAC
Codec ID                                 : alac
Codec ID/Info                            : Apple Lossless Audio Codec
Duration                                 : 8 min 29 s
Duration_LastFrame                       : -44 ms
Bit rate mode                            : Variable
Bit rate                                 : 1 033 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Bit depth                                : 16 bits
Stream size                              : 62.8 MiB (100%)
Language                                 : English
Encoded date                             : UTC 2017-07-24 15:16:30
Tagged date                              : UTC 2017-07-24 15:16:30

Code: Select all

General
Complete name                            : ~/.MyMediaForAlexa/TranscodeCache/mrhejrnb.k9t.mp3
Format                                   : MPEG Audio
File size                                : 15.6 MiB
Duration                                 : 8 min 29 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 256 kb/s
Album                                    : Yessongs
Album/Performer                          : Yes
Part/Position                            : 1
Part/Total                               : 2
Track name                               : Roundabout
Track name/Position                      : 8
Track name/Total                         : 8
Performer                                : Yes
Genre                                    : Progressive Rock
Recorded date                            : 1973
Writing library                          : LAME3.100
major_brand                              : M4A 
minor_version                            : 0
compatible_brands                        : M4A mp42isom

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo / MS Stereo
Duration                                 : 8 min 29 s
Bit rate mode                            : Constant
Bit rate                                 : 256 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 38.281 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 15.6 MiB (100%)
Writing library                          : LAME3.100
Post Reply