Improvements to VLCMedia.tracksInformation
Stop using the deprecated API and use the new API.
LIBVLC_DEPRECATED LIBVLC_API unsigned libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t ***tracks );
↓
LIBVLC_API libvlc_media_tracklist_t * libvlc_media_get_tracklist( libvlc_media_t *p_md, libvlc_track_type_t type );
Replace the return value of VLCMedia.tracksInformation from NSArray <NSDictionary *> *
to NSArray <VLCMediaTracksInformation *> *
.
let media: VLCMedia = ...
// before
// trackInformation is imported as [Any]
let tracksInfo = media.tracksInformation as! [[AnyHashable: Any]]
let videoTrack = tracksInfo.first(where: { $0[VLCMediaTracksInformationType] as? String == VLCMediaTracksInformationTypeVideo })
let width = videoTrack[VLCMediaTracksInformationVideoWidth] as? Int
let height = videoTrack[VLCMediaTracksInformationVideoHeight] as? Int
//after
// trackInformation is imported as [VLCMediaTracksInformation]
let tracksInfo = media.tracksInformation
guard let videoTrack = tracksInfo.compactMap(\.video).first else { return }
let width = videoTrack.width
let height = videoTrack.height
Related #416 (closed)
Close this merge request if you don't need it.
Edited by Felix Paul Kühne