Music_Player3/MusicPlayer/MP/Common/Extension(扩展)/AVPlayerItem.swift
2024-05-29 13:20:07 +08:00

23 lines
466 B
Swift

//
// AVPlayerItem.swift
// MusicPlayer
//
// Created by Mr.Zhou on 2024/5/23.
//
import AVFoundation
import ObjectiveC
private var playerItemContext: UInt8 = 0
extension AVPlayerItem {
var uniqueID: String? {
get {
return objc_getAssociatedObject(self, &playerItemContext) as? String
}
set {
objc_setAssociatedObject(self, &playerItemContext, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}