Skip to content

Instantly share code, notes, and snippets.

@drexel-ue
Created June 19, 2019 10:28
Show Gist options
  • Select an option

  • Save drexel-ue/e27199cc060b61146830ba89b1754512 to your computer and use it in GitHub Desktop.

Select an option

Save drexel-ue/e27199cc060b61146830ba89b1754512 to your computer and use it in GitHub Desktop.
void _uploadVideo(UserData userData) async {
String selectedFilter = _filterTitleSubject.value ?? 'Normal';
final url = 'http://10.0.2.2:8888/videos';
final body = {
'video': base64Encode(await videoFile.readAsBytes()),
'userID': userData.id,
'createdBy': userData.displayName,
'appliedFilter': selectedFilter,
'title': title,
'aspectRatio': cameraController.value.aspectRatio,
'content': content,
'public': public,
'latitude': latitude,
'longitude': longitude,
'type': type,
'duration': videoPlayerController.value.duration.inMilliseconds,
'startTime': startTime,
};
// final headers = {"Authorization": "Bearer ${userData.token}"};
final response = await http.post(
url,
body: body,
// headers: headers,
);
if (response.statusCode == 200) {
print("UPLOADED!");
} else {
print('>>>RESPONSE ${response.reasonPhrase}');
}
_clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment