Closed nicolelehrer closed 8 years ago
build this please
edit: thought I was in the app repo :P
Looks great @nicole 👍
Thanks a lot @huebnerob. @jasonhawkins - this was the PR I was hoping you could do a cursory look at given Rob's reviewed it. Just another head check on the reasoning in the PR description since I believe I'm modifying some fairly old player stuff.
Ticket
Required for Vimeans only VIM-4496
Ticket Summary
To support DRM, we need to directly access the player asset and set its delegate. See changes to
playVideoWithURL:
captured here: https://github.vimeows.com/MobileApps/Vimeo-iOS/pull/938/filesAs a result, we're now using
setAsset:
instead ofsetURL:
. This left local playback unaffected. But in airplay mode, the player never received a status change that the player item was ready to play. (If a video was already playing, it could be air played, but the next video would not play).It's not clear why this was happening, but the way in which we create the asset seems like it could be the culprit. The init method we used specified that we should pre-load "tracks". This in effect excluded "duration" as a key to be preloaded. The docs say:
It's interesting that the most basic player Item creation method
playerItemWithAsset
(which is what this PR suggests we use) does not exclude the duration key. The docs say that callingplayerItemWithAsset
is equivalent to+playerItemWithAsset:automaticallyLoadedAssetKeys:
and passing @[ @"duration" ] as the value of automaticallyLoadedAssetKeys.Also, it's not clear if we necessarily need to pre-load tracks because it seems we don't need to access them outside of the context of playback. The docs say
From an older WWDC talk - 2014
Since I couldn't find a clear link between our playback flow, airplay, and the creation of assets, the snippets above were meant to show it's likely not necessary to preload tracks, it could be disrupting something in our current playback flow and we can adopt the simpler method.
Implementation Summary
Updated the init method used for creating our AVAsset.
How to Test