Out of curiosity, is it the same stream each time? As in, the URL is identical each time?
I'm sorry to hear that this is failing, and that it is not consistently failing. -Mike -m.e. On Fri, Jul 27, 2012 at 12:06 PM, Richard.Leagh <[email protected]>wrote: > The funny thing is, reading from the stream works on and off. Today, > using the same exact code I was able to successfully grab a video off > Picasa twice after hours of not being able to. > > On Jul 27, 11:27 am, "Richard.Leagh" <[email protected]> wrote: > > 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. > > -- 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.
