youtube - How to measure upload bitrate using Java+Google Data API -


i'm writing java client application uses google data api upload things youtube. i'm wondering how go tracking progress of upload, using google data api library call service.insert insert new video, blocks until complete.

has else come solution monitor status of upload , count bytes sent?

thanks ideas

link:

http://code.google.com/apis/youtube/2.0/developers_guide_java.html#direct_upload

extend com.google.gdata.data.media.mediasource writeto() include counter of bytesread:

     public static void writeto(mediasource source, outputstream outputstream)         throws ioexception {        inputstream sourcestream = source.getinputstream();       bufferedoutputstream bos = new bufferedoutputstream(outputstream);       bufferedinputstream bis = new bufferedinputstream(sourcestream);       long bytecounter = 0l;         try {         byte [] buf = new byte[2048]; // transfer in 2k chunks         int bytesread = 0;         while ((bytesread = bis.read(buf, 0, buf.length)) >= 0) {           // byte counter           bytecounter += bytesread;           bos.write(buf, 0, bytesread);          }         bos.flush();       } {         bis.close();       }     }   } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -