lihaosky / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Nexus player doesn't accept the same encoding as Chromecast for video #496

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1) Programatically load a video on the receiver using 
cast.receiver.MediaManager.
2) Observe the headers in the request.

ON A CHROMECAST:
accept: "*/*"
accept-encoding: "identity;q=1, *;q=0"
accept-language: "en-US,en;q=0.8"
connection: "keep-alive"
host: "192.168.0.127:5556"
origin: "https://s3.amazonaws.com"
range: "bytes=611576-"
user-agent: "Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/537.36 (KHTML, 
like Gecko) Chrome/37.0.2062.0 Safari/537.36 CrKey/22062"

ON A NEXUS PLAYER
accept: "*/*"
accept-encoding: "gzip,deflate"
accept-language: "en-CA"
connection: "keep-alive"
host: "192.168.0.127:5556"
origin: "https://s3.amazonaws.com"
user-agent: "Mozilla/5.0 (Linux; Android 5.0; Nexus Player Build/LRX21V) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.0 Safari/537.36 
CrKey/22246"

Observe that the accept-encoding does not match.

I'm observing that when we try to respond without gzip encoding, a new request 
gets made from the nexus player.

Original issue reported on code.google.com by j.brugge...@gmail.com on 29 Jan 2015 at 5:42

GoogleCodeExporter commented 9 years ago
I thought it was supposed to work out of box ;)

Original comment by m...@thatmatt.ca on 29 Jan 2015 at 6:39

GoogleCodeExporter commented 9 years ago
On Videostream we can absolutely confirm that this is an issue :-/

Original comment by mathieu....@matbee.com on 29 Jan 2015 at 7:22

GoogleCodeExporter commented 9 years ago
Yes, the difference you're seeing is due to differences between the Android 
network stack and Chrome Linux's network stack. You'll see the same difference 
if you load media in an HTML page on Chrome Linux vs. Chrome Android (on your 
phone). Android will use "transparent gzip" (automatically adding the gzip 
encoding response to outgoing requests) even if you just do something as simple 
as the following:

            URL url = new URL("...");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            int response = connection.getResponseCode();

Accept-encoding does not mean that you _must_ send gzip response, but if you 
specify "Content-encoding: gzip" in your response to it then your content 
obviously must also be gzipped.

That said, is there anything that you're seeing _not_ working as a result, or 
are you just reporting that this implementation difference exists?

Original comment by gun...@google.com on 30 Jan 2015 at 6:06

GoogleCodeExporter commented 9 years ago
Yes, our app, Videostream, does not work on the Nexus Player, but it does work 
on Chromecast. 

We assume the problem was that we are not gzip'ing content. It looks like the 
nexus player makes a ton of requests to our app and it eventually crashes as a 
result.

Can you confirm that sending non g'zipped video data to the nexus player should 
work?

Original comment by j.brugge...@gmail.com on 30 Jan 2015 at 8:17

GoogleCodeExporter commented 9 years ago
Sending non-gzipped content is definitely okay, as long as you're not also 
reporting "Content-encoding: gzip" in the response headers. IIRC Plex similarly 
serves non-gzipped content in response to the same request headers.

Original comment by gun...@google.com on 4 Feb 2015 at 6:00

GoogleCodeExporter commented 9 years ago
Closing this issue for now.  If you are still experiencing problems, let us 
know and we can reopen the ticket.

Original comment by jonathan...@google.com on 10 Feb 2015 at 9:40