java - YouTube API upload stuck on processing -
i'm trying upload video own youtube account using v3 api , java library. if call method, see video permanently stuck @ "processing..." stage in youtube account. exception never reaches catch blocks, , i've managed upload same videos logging youtube directly , using drive api (with similar code what's listed below). missing?
public boolean savetoyoutube(file fileorig) { youtube service = new youtube.builder(httptransport, jsonfactory, getcredential()).build(); // add information video before uploading. video video = new video(); videostatus status = new videostatus(); status.setprivacystatus("private"); //public, private video.setstatus(status); videosnippet snippet = new videosnippet(); snippet.settitle("test"); snippet.setdescription("this test video"); list<string> tags = new arraylist<string>(); tags.add("test"); tags.add("example"); tags.add("java"); tags.add("youtube data api v3"); tags.add("erase me"); snippet.settags(tags); video.setsnippet(snippet); try { inputstreamcontent content = new inputstreamcontent("video/avi", new fileinputstream(fileorig)); youtube.videos.insert videoinsert = service.videos().insert("snippet,status", video, content); video returnedvideo = videoinsert.execute(); system.out.println("\n================== returned video ==================\n"); system.out.println(" - id: " + returnedvideo.getid()); system.out.println(" - title: " + returnedvideo.getsnippet().gettitle()); system.out.println(" - tags: " + returnedvideo.getsnippet().gettags()); system.out.println(" - privacy status: " + returnedvideo.getstatus().getprivacystatus()); system.out.println(" - video count: " + returnedvideo.getstatistics().getviewcount()); } catch (googlejsonresponseexception e) { system.err.println("googlejsonresponseexception code: " + e.getdetails().getcode() + " : " + e.getdetails().getmessage()); e.printstacktrace(); } catch (filenotfoundexception ex) { ex.printstacktrace(); } catch (ioexception ex) { ex.printstacktrace(); } return true; }
note: can see correct title, tags, , privacy level of video in account.
Comments
Post a Comment