Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Refactor playerItem KVO registration #9

Merged
merged 2 commits into from
Nov 2, 2014

Conversation

jballanc
Copy link
Contributor

@jballanc jballanc commented Nov 1, 2014

No description provided.

The `mediaPlayerDidChange:` method is removed since it was only being
called by the `PRXPlayerAVPlayerContext` notification which is no longer
registered on any key path. The functionality in `mediaPlayerDidChange:`
had previously been moved to the `setPlayer:` method.
In order to keep proper accounting of observers added and removed from
the `AVPlayerItem` in the current player, the
`mediaPlayerCurrentItemDidChange:` method that is called on a player
item change now utilizes the change dictionary to get the old and new
items and register and deregister notifications appropriately. In order
for this to also work on player change notifications, a dummy change
dictionary is constructed and passed along.
}

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
playerPeriodicTimeObserver = [self.player addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(1, 1000) queue:self.class.sharedQueue usingBlock:^(CMTime time) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I'm missing something, but if this observer is getting removed, what is happening to update progress bars/etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the functionality from this method is duplicated in setPlayer:, for example: https://github.com/jballanc/PRXPlayer/blob/master/PRXPlayer.m#L153

farski added a commit that referenced this pull request Nov 2, 2014
Refactor playerItem KVO registration
@farski farski merged commit 2ded45f into PRX:master Nov 2, 2014
@jballanc jballanc deleted the playerItem-kvo-refactor branch November 18, 2014 01:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants