Skip to content

Commit

Permalink
play overlay for video files
Browse files Browse the repository at this point in the history
  • Loading branch information
thevaidik authored and tmolitor-stud-tu committed Aug 29, 2024
1 parent 242f7c4 commit 88f247d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Monal/Classes/MediaGallery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ class MediaItem: Identifiable, ObservableObject {
}
}

struct MediaItemView: View {
@StateObject private var item: MediaItem
struct MediaItemView: View {
@StateObject private var item: MediaItem

init(fileInfo: [String: Any]) {
_item = StateObject(wrappedValue: MediaItem(fileInfo: fileInfo))
}
init(fileInfo: [String: Any]) {
_item = StateObject(wrappedValue: MediaItem(fileInfo: fileInfo))
}

var body: some View {
var body: some View {
ZStack {
Group {
if let thumbnail = item.thumbnail {
Image(uiImage: thumbnail)
Expand All @@ -174,8 +175,19 @@ class MediaItem: Identifiable, ObservableObject {
.frame(width: 100, height: 100)
.clipShape(RoundedRectangle(cornerRadius: 10))
.overlay(RoundedRectangle(cornerRadius: 10).stroke(Color.gray, lineWidth: 1))

// Add play icon overlay for video files
if let mimeType = item.fileInfo["mimeType"] as? String, mimeType.starts(with: "video/") {
Image(systemName: "play.circle.fill")
.resizable()
.frame(width: 30, height: 30)
.foregroundColor(.white)
.background(Color.black.opacity(0.5))
.clipShape(Circle())
}
}
}
}

struct MediaItemDetailView: View {
@StateObject private var item: MediaItem
Expand Down

0 comments on commit 88f247d

Please sign in to comment.