|
@@ -3,12 +3,19 @@ package com.bomostory.sceneeditmodule.screen.movie
|
|
|
import android.arch.lifecycle.MutableLiveData
|
|
|
import android.arch.lifecycle.ViewModel
|
|
|
import android.content.ContentResolver
|
|
|
+import android.content.Context
|
|
|
import android.media.MediaMetadataRetriever
|
|
|
import com.bomostory.sceneeditmodule.basicdata.*
|
|
|
import com.bomostory.sceneeditmodule.utils.TimeUtils
|
|
|
+import com.example.bomocloud.BoMoCloud
|
|
|
+import com.example.bomocloud.video.UploadVideoData
|
|
|
import com.example.exportmedia.MediaHelper
|
|
|
import com.example.exportmedia.audio.AudioEditor
|
|
|
+import com.example.tfat.myapplication.R
|
|
|
import io.reactivex.Observable
|
|
|
+import okhttp3.MediaType
|
|
|
+import okhttp3.MultipartBody
|
|
|
+import okhttp3.RequestBody
|
|
|
import java.io.File
|
|
|
|
|
|
class MovieEditViewModel : ViewModel() {
|
|
@@ -98,4 +105,15 @@ class MovieEditViewModel : ViewModel() {
|
|
|
return totalPeriod
|
|
|
}
|
|
|
|
|
|
+ fun uploadVideo(context: Context, file: File, project: Project): Observable<UploadVideoData> {
|
|
|
+ val id = context.getString(R.string.bomo_cloud_client_id)
|
|
|
+ val secret = context.getString(R.string.bomo_cloud_client_secret)
|
|
|
+ val author = project.author ?: ""
|
|
|
+ val name = project.name ?: ""
|
|
|
+ val category = 0
|
|
|
+ val filePart = MultipartBody.Part.createFormData("file", file.name, RequestBody.create(MediaType.parse("video/*"), file))
|
|
|
+ return BoMoCloud(id, secret).videoService
|
|
|
+ .uploadVideo(id, secret, author, name, category, filePart)
|
|
|
+ }
|
|
|
+
|
|
|
}
|