Skip to content

Instantly share code, notes, and snippets.

View mhijack's full-sized avatar
🎯
Focusing

Jianyuan Chen mhijack

🎯
Focusing
View GitHub Profile
@netgfx
netgfx / addObservers.swift
Last active December 14, 2023 13:02
Add observers to AVPlayer
// listening for current item change
self.audioQueueObserver = self.playerQueue?.observe(\.currentItem, options: [.new]) {
[weak self] (player, _) in
print("media item changed...")
}
// listening for current item status change
self.audioQueueStatusObserver = self.playerQueue?.currentItem?.observe(\.status, options: [.new, .old], changeHandler: {
(playerItem, change) in
if playerItem.status == .readyToPlay {
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR