-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[ASVideoNode] Use of URL in construction #1600
Comments
hey @gazreese, I'd just like to add that after further investigation, I believe it's no longer required to build the AVPlayerItem from the URL (for HLS). Hence, the check for tracks should no longer be needed. Apparently the AVFoundation guide was out of date. In this release note -- under Enhancements for HTTP Live Streaming -- it states that all assets (HLS and non-HLS) may be constructed from an AVURLAsset. We just have to call |
@chourobin That's great news! The workaround of extracting the URL is troublesome, as detailed by @gazreese. Let me know If you'd like any help with your PR 😃 |
This sounds great to me guys, well spotted!
|
@chourobin @gazreese @ejensen: awesome collaboration here. Keep up the great work! |
Summary: Upstream PR: facebookarchive#1748 Apple claims in the [[ https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html | AVFoundationProgramming Guide ]] that HLS videos can be constructed only through URL, but later with [[ https://developer.apple.com/library/ios/releasenotes/AudioVideo/RN-AVFoundation-Old/ | iOS 4.3 release notes ]] it claimed to bring updates to how the HLS videos should be initialized, which works with asset too. I’ve tested with both, and it looks like initializing with asset is buggy. The first initialization would be successful, however if you re-initialize it again within a few seconds, the asset won’t be loaded successfully ([[ https://www.dropbox.com/s/5yqn9nvce2rga1m/HLS_constructed_with_asset.mov?dl=0 | simulator recording ]]). I am reverting this to constructing AVPlayerItem using URL for HLS videos, which solves the bug ([[ https://www.dropbox.com/s/h2b59c2q1jnkb17/HLS_constructed_from_url.mov?dl=0 | simulator recording ]]). This issue has been discussed earlier by others but it didn't seem to work out the way we wanted: facebookarchive#1600 Reviewers: bin, yunnanwu, levi, garrett, schneider Reviewed By: garrett, schneider Subscribers: garrett, levi Differential Revision: https://phabricator.pinadmin.com/D100271
I'm not sure whether this is a bug, but thought I'd raise it anyway for discussion with @appleguy.
In my original changes to add URL / HLS Video support to the ASVideoNode I had explicit construction from either a URL or an AVAsset. This was because during my testing I had problems with the AVPlayerItem if I tried to construct from an HLS AVURLAsset rather than constructing directly from the URL. I can't remember exactly what the problem was if I'm honest, but it seemed prudent to mirror the construction of the AVPlayerItem in the ASVideoNode interface as this was the underlying tech.
Since the original merge the API for ASVideoNode has been simplified to only take an AVAsset. I assume someone has run into similar problems I had however as looking at the code above the internals have been reverted to creating the AVPlayerItem directly from the URL, except this time the URL is extracted from the AVAsset and the player item is constructed without it.
What this does however is drop the use of the AVURLAsset that the user uses for construction without any warning. If the user constructed the video node with a normal AVAsset then after construction videoNode.playerItem.asset would be the same as videoNode.asset. If the user observed anything in the AVAsset before construction or accessed anything inside videoNode.asset everything would work.
Looking at it now however if the user constructs with an AVURLAsset the asset is dropped. I assume the AVPlayerItem makes a new asset if you construct with the raw URL, so videoNode.playerItem.asset would no longer be the same object as videoNode.asset.
The .asset property is also used throughout the class, i.e.
Looking at where this is called, you can see we're probably generating the placeholder image from the AVAsset that we're no longer using:
Like I say, I'm not sure this is even a bug but it just didn't look ideal so thought I'd raise it for discussion.
The text was updated successfully, but these errors were encountered: