I'm having an issue grabbing the video stream from the url supplied by
MediaContent of a PhotoEntry. I've checked to make sure that the
PhotoEntry itself is definitely a video, here's a snippet of my code:
List<PhotoEntry> photos = ....
for(PhotoEntry media : photos) {
List<MediaContent> content = media.getMediaContents();
if(content.size()>1) { //its a video, only a video has more than 1
stream
byte[] videoData = getData(new URL(content.get(2).getUrl()));
//the URL points to a h264 encoded version
}
}
public byte[] getData(URL datastream) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
InputStream is = datastream.openStream();
int c;
try {
while((c=is.read())!=-1) {
outputStream.write(c);
}
} catch(Exception e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch(Exception f) {}
}
return outputStream.toByteArray(); }
For some reason, the program is getting stuck in the While loop which
I'm assuming could only be because the value of the InputStream is
never -1. Am I just missing something simple here? Please let me know.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-picasa-data-api?hl=en.