This is only a day after Google released All Access for Google Music but the URL array in the JSON response for streamed (not owned) media contains URLs that wont stream. Has anybody looked into this? They play for a fraction of a second and then terminate.
I've been looking into it and though I haven't found a solution I believe this may be helpful in determining what needs to be done:
Notice that the URLs have a range param but notice that the first one may be like:
range=0-39706
But the next one would be:
range=37615-119118
Which seems odd that the next segment would start at a value less than where the previous segment ended. My high level guess is that we will need to write to a file using this range and append the bytes appropriately so that they ARE in order.
But this is just my guess, haven't attempted doing this but I am working on it.
UPDATE
I have successfully accomplished the above, but in C++ using the Qt framework so not Android. But there does seem to be somewhat of an issue in my implementation because every segment has a strange squeak noise so I may need to adjust the byte position a little, but I can get through the whole song now.
Not exactly sure how this would translate to Android but I think it would be something like:
File file = new File("tempFile");
file.open(WRITE_ONLY);
file.write(startingByte, data);
And as you loop through just parse out the starting byte for each segment.
EDIT
Found out my issue was that I was closing the file after each segment. If I leave the file open until I finish writing all the segments then the song plays through perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With