-
-
Save sbis04/43f1ce5f6703f52a57cc163ea0748859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<VideoData> storeVideo({String videoUrl}) async { | |
Response response; | |
try { | |
response = await _dio.post( | |
"/assets", | |
data: { | |
"videoUrl": videoUrl, | |
}, | |
); | |
} catch (e) { | |
print('Error starting build: $e'); | |
throw Exception('Failed to store video on MUX'); | |
} | |
if (response.statusCode == 200) { | |
VideoData videoData = VideoData.fromJson(response.data); | |
String status = videoData.data.status; | |
while (status == 'preparing') { | |
print('processing...'); | |
await Future.delayed(Duration(seconds: 1)); | |
videoData = await checkPostStatus(videoId: videoData.data.id); | |
status = videoData.data.status; | |
} | |
return videoData; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment