getTranscodeDocumentsProgress method
dynamic
getTranscodeDocumentsProgress()
Implementation
getTranscodeDocumentsProgress() {
if (uploadDocuments.isNotEmpty) {
_timer ??= Timer.periodic(Duration(seconds: 1), (Timer timer) {
TCICLog.info(
"getDocs",
actionModule: ActionModule.documentObs.name,
actionName: ActionName.getDocs.name,
);
final docIds = uploadDocuments.map((i) => i.docId).toList();
if (docIds.isEmpty) {
_timer?.cancel();
} else {
_documentUseCases.getDocumentsTranscodeInfo(docIds).then((v) {
if (v != null && v.documents.isNotEmpty) {
for (var doc in v.documents) {
_updateDocumentInLists(doc);
final progressResult = {
"taskId": doc.hashId,
"progress": doc.transcodeProgress,
"uploadType": 1,
};
TCICController.instance.getEventBus().fire(
MainEvent(
type: EventTypeEnum.documentUploadProgress,
data: progressResult,
),
);
if (doc.transcodeProgress == 100) {
uploadDocuments.removeWhere((i) => i.docId == doc.docId);
_refreshDocumens();
}
}
update();
}
});
}
});
} else {
cancelGetTranscodeDocumentProgress();
}
}