내 안드로이드 응용 프로그램에서 Dailymotion cloud를 사용하여 서버에 비디오를 업로드하고 있습니다. 업로드하는 동안 진행률 표시 줄을 표시하고 싶지만 진행률 막대를 업데이트하기 위해 바이트 값을 바이트 단위로 가져올 수있는 방법을 모르겠습니다.dailymotion cloud 업로드를위한 진행률 표시 줄을 표시하는 방법
이 내가이 progress bar in java을 발견하지만 난 시간 dailymotion API를이 방법으로 구현할 수있는 방법을 모르는 시간 dailymotion 클라우드 API를 링크 Dailymotion cloud api link
인터넷에서 검색하는 동안이다. 내가 여기에 진행률 표시 줄 를 표시하는 비동기 작업을 사용하고
여기
try
{
CloudKey cloud = new CloudKey(user_id, api_key);
File f = new File(selectedVideoPath);
String media_id = cloud.mediaCreate(f);
System.out.println(media_id);
Log.d("Testing", "media_id is"+media_id);
}
을 업로드 안드로이드 코드 그리고 것은 데일리 모션의 API의 Cloud.class의 mediacreate()있는 내가 진행률 표시 줄을 표시하려면 .. 어떤 생각입니다
public String mediaCreate(File f) throws Exception
{
return this.mediaCreate(f, null, null);
}
public String mediaCreate(File f, DCArray assets_names, DCObject meta) throws Exception
{
String upload_url = this.fileUpload();
PostMethod filePost = null;
int status;
try
{
filePost = new PostMethod(upload_url);
Part[] parts = {
new FilePart("file", f)
};
filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
status = client.executeMethod(filePost);
if (status == HttpStatus.SC_OK)
{
ObjectMapper mapper = new ObjectMapper();
DCObject json_response = DCObject.create(mapper.readValue(filePost.getResponseBodyAsString(), Map.class));
return this.mediaCreate(json_response.pull("url"), assets_names, meta);
}
else
{
throw new DCException("Upload failed.");
}
}
catch (Exception e)
{
throw new DCException("Upload failed: " + e.getMessage());
}
finally
{
if (filePost != null)
{
filePost.releaseConnection();
}
}
}