Skip to content

Commit

Permalink
TW-1269: can't play video in safari
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn authored and hoangdat committed Feb 26, 2024
1 parent 02d5538 commit 2886354
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/presentation/extensions/send_file_web_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ extension SendFileWebExtension on Room {
) async {
if (originalFile.bytes == null) return null;
try {
final url = originalFile.bytes?.toWebUrl();
final url = originalFile.bytes?.toWebUrl(mimeType: originalFile.mimeType);
if (url == null) {
throw Exception('Missing bytes in $originalFile');
}
Expand Down Expand Up @@ -328,7 +328,7 @@ extension SendFileWebExtension on Room {
return null;
}
try {
final url = originalFile.bytes?.toWebUrl();
final url = originalFile.bytes?.toWebUrl(mimeType: originalFile.mimeType);
if (url == null) {
throw Exception('$originalFile is empty');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/mixins/handle_video_download_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mixin HandleVideoDownloadMixin {
lastSelectedVideoEventId = event.eventId;
if (PlatformInfos.isWeb) {
final videoBytes = await event.downloadAndDecryptAttachment();
final url = videoBytes.bytes?.toWebUrl();
final url = videoBytes.bytes?.toWebUrl(mimeType: videoBytes.mimeType);
if (url == null) {
throw Exception('$videoBytes is null');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/extension/web_url_creation_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'dart:typed_data';
import 'package:universal_html/html.dart' as html;

extension WebUrlCreationExtension on Uint8List {
String toWebUrl() {
final blob = html.Blob([this]);
String toWebUrl({required String mimeType}) {
final blob = html.Blob([this], mimeType);
return html.Url.createObjectUrlFromBlob(blob);
}
}

0 comments on commit 2886354

Please sign in to comment.