@@ -199,11 +199,7 @@ public struct LocalFileInformationGenerator {
199
199
static public var audioThumbnail : ( _ fileURL: URL , _ dimension: CGSize ? ) -> ImageClass ? = { fileURL, dimension in
200
200
let playerItem = AVPlayerItem ( url: fileURL)
201
201
let metadataList = playerItem. asset. commonMetadata
202
- #if swift(>=4.0)
203
202
let commonKeyArtwork = AVMetadataKey . commonKeyArtwork
204
- #else
205
- let commonKeyArtwork = AVMetadataCommonKeyArtwork
206
- #endif
207
203
for item in metadataList {
208
204
if item. commonKey == commonKeyArtwork {
209
205
if let data = item. dataValue {
@@ -356,11 +352,7 @@ public struct LocalFileInformationGenerator {
356
352
let playerItem = AVPlayerItem ( url: fileURL)
357
353
let metadataList = playerItem. asset. commonMetadata
358
354
for item in metadataList {
359
- #if swift(>=4.0)
360
- let commonKey = item. commonKey? . rawValue
361
- #else
362
- let commonKey = item. commonKey
363
- #endif
355
+ let commonKey = item. commonKey? . rawValue
364
356
if let key = makeKeyDescription ( commonKey) {
365
357
if commonKey == " location " , let value = item. stringValue, let loc = parseLocationData ( value) {
366
358
keys. append ( key)
@@ -401,16 +393,12 @@ public struct LocalFileInformationGenerator {
401
393
dic = audioprops. prop
402
394
keys = audioprops. keys
403
395
dic. removeValue ( forKey: " Duration " )
404
- if let index = keys. index ( of: " Duration " ) {
396
+ if let index = keys. firstIndex ( of: " Duration " ) {
405
397
keys. remove ( at: index)
406
398
}
407
399
}
408
400
let asset = AVURLAsset ( url: fileURL, options: nil )
409
- #if swift(>=4.0)
410
401
let videoTracks = asset. tracks ( withMediaType: AVMediaType . video)
411
- #else
412
- let videoTracks = asset. tracks ( withMediaType: AVMediaTypeVideo)
413
- #endif
414
402
if let videoTrack = videoTracks. first {
415
403
var bitrate : Float = 0
416
404
let width = Int ( videoTrack. naturalSize. width)
@@ -424,11 +412,7 @@ public struct LocalFileInformationGenerator {
424
412
add ( key: " Duration " , value: TimeInterval ( duration) . formatshort)
425
413
add ( key: " Video Bitrate " , value: " \( Int ( ceil ( bitrate / 1000 ) ) ) kbps " )
426
414
}
427
- #if swift(>=4.0)
428
415
let audioTracks = asset. tracks ( withMediaType: AVMediaType . audio)
429
- #else
430
- let audioTracks = asset. tracks ( withMediaType: AVMediaTypeAudio)
431
- #endif
432
416
// dic["Audio channels"] = audioTracks.count
433
417
var bitrate : Float = 0
434
418
for track in audioTracks {
0 commit comments