我正在开发一个使用 TUS 方法将视频上传到 Vimeo 的应用程序。
我为 Fast Android Networking 编写了一个简单的包装器,用于上传视频文件的每个部分。
fun patch(
destination: RequestDestination = RequestDestination.Api,
url: String,
headers: Map<String, Any> = mapOf(),
body: ByteArray? = null,
contentType: String? = null,
priority: Priority = Priority.MEDIUM,
jsonRequest: Boolean = true,
success: (Any?) -> Unit,
failure: (ANError?) -> Unit
) {
val requestUrlString = getFullUrl(destination, url) // Determines the destination URL, is working correctly
val request = AndroidNetworking.patch(requestUrlString)
setRequestAttributes(request, headers, destination, priority) // Adds the request params, headers, etc to the request, …Run Code Online (Sandbox Code Playgroud)