damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

MediaView.swift (1006B)


      1 //
      2 //  MediaView.swift
      3 //  damus
      4 //
      5 //  Created by William Casarin on 2023-06-05.
      6 //
      7 
      8 import SwiftUI
      9 
     10 /*
     11  struct MediaView: View {
     12  let geo: GeometryProxy
     13  let url: MediaUrl
     14  let index: Int
     15  
     16  var body: some View {
     17  Group {
     18  switch url {
     19  case .image(let url):
     20  Img(geo: geo, url: url, index: index)
     21  .onTapGesture {
     22  open_sheet = true
     23  }
     24  case .video(let url):
     25  DamusVideoPlayer(url: url, model: video_model(url), video_size: $video_size)
     26  .onChange(of: video_size) { size in
     27  guard let size else { return }
     28  
     29  let fill = ImageFill.calculate_image_fill(geo_size: geo.size, img_size: size, maxHeight: maxHeight, fillHeight: fillHeight)
     30  
     31  print("video_size changed \(size)")
     32  if self.image_fill == nil {
     33  print("video_size firstImageHeight \(fill.height)")
     34  firstImageHeight = fill.height
     35  state.events.get_cache_data(evid).media_metadata_model.fill = fill
     36  }
     37  
     38  self.image_fill = fill
     39  }
     40  }
     41  }
     42  }
     43  }
     44  
     45  struct MediaView_Previews: PreviewProvider {
     46  static var previews: some View {
     47  MediaView()
     48  }
     49  }
     50  */