AVAssetReferenceRestrictions на iOS 13 - PullRequest
       28

AVAssetReferenceRestrictions на iOS 13

0 голосов
/ 27 сентября 2019

Рабочая область: iOS 13.0, Xcode 11.0

TL; DR: что-то не так с AVAssetReferenceRestrictions в iOS 13?

Часть 1:

В AVAsset.h AVAssetReferenceRestrictions определены как:

  @enum         AVAssetReferenceRestrictions
  @abstract     These constants can be passed in to AVURLAssetReferenceRestrictionsKey to control the resolution of references to external media data.

  @constant     AVAssetReferenceRestrictionForbidNone
    Indicates that all types of references should be followed.
  @constant     AVAssetReferenceRestrictionForbidRemoteReferenceToLocal
    Indicates that references from a remote asset (e.g. referenced via http URL) to local media data (e.g. stored in a local file) should not be followed.
  @constant     AVAssetReferenceRestrictionForbidLocalReferenceToRemote
    Indicates that references from a local asset to remote media data should not be followed.
  @constant     AVAssetReferenceRestrictionForbidCrossSiteReference
    Indicates that references from a remote asset to remote media data stored at a different site should not be followed.
  @constant     AVAssetReferenceRestrictionForbidLocalReferenceToLocal
    Indicates that references from a local asset to local media data stored outside the asset's container file should not be followed.
  @constant     AVAssetReferenceRestrictionForbidAll
    Indicates that only references to media data stored within the asset's container file should be allowed.
*/
typedef NS_OPTIONS(NSUInteger, AVAssetReferenceRestrictions) {
    AVAssetReferenceRestrictionForbidNone = 0UL,
    AVAssetReferenceRestrictionForbidRemoteReferenceToLocal = (1UL << 0),
    AVAssetReferenceRestrictionForbidLocalReferenceToRemote = (1UL << 1),
    AVAssetReferenceRestrictionForbidCrossSiteReference = (1UL << 2),
    AVAssetReferenceRestrictionForbidLocalReferenceToLocal = (1UL << 3),
    AVAssetReferenceRestrictionForbidAll = 0xFFFFUL,

    AVAssetReferenceRestrictionDefaultPolicy = AVAssetReferenceRestrictionForbidLocalReferenceToRemote
};

А свойство AVAsset определено как:

@property       referenceRestrictions
@abstract       Indicates the reference restrictions being used by the receiver.
@discussion
    For AVURLAsset, this property reflects the value passed in for AVURLAssetReferenceRestrictionsKey, if any. See AVURLAssetReferenceRestrictionsKey below for a full discussion of reference restrictions. The default value for this property is AVAssetReferenceRestrictionForbidNone.
@property (nonatomic, readonly) AVAssetReferenceRestrictions referenceRestrictions API_AVAILABLE(macos(10.7), ios(5.0), tvos(9.0)) API_UNAVAILABLE(watchos);

Итак, хотя в документации по свойству явно указано, что значением по умолчанию является AVAssetReferenceRestrictionForbidNone, AVAssetReferenceRestrictionDefaultPolicy в настоящее время AVAssetReferenceRestrictionForbidLocalReferenceToRemote.Документация не обновляется должным образом, или AVAssetReferenceRestrictionDefaultPolicy отличается от того, что я ожидал?

Часть 2:

В аналоге Swift он определен (преобразован?) Кактакие:

  @enum         AVAssetReferenceRestrictions
  @abstract     These constants can be passed in to AVURLAssetReferenceRestrictionsKey to control the resolution of references to external media data.

  @constant     AVAssetReferenceRestrictionForbidNone
    Indicates that all types of references should be followed.
  @constant     AVAssetReferenceRestrictionForbidRemoteReferenceToLocal
    Indicates that references from a remote asset (e.g. referenced via http URL) to local media data (e.g. stored in a local file) should not be followed.
  @constant     AVAssetReferenceRestrictionForbidLocalReferenceToRemote
    Indicates that references from a local asset to remote media data should not be followed.
  @constant     AVAssetReferenceRestrictionForbidCrossSiteReference
    Indicates that references from a remote asset to remote media data stored at a different site should not be followed.
  @constant     AVAssetReferenceRestrictionForbidLocalReferenceToLocal
    Indicates that references from a local asset to local media data stored outside the asset's container file should not be followed.
  @constant     AVAssetReferenceRestrictionForbidAll
    Indicates that only references to media data stored within the asset's container file should be allowed.

public struct AVAssetReferenceRestrictions : OptionSet {

    public init(rawValue: UInt)

    public static var forbidRemoteReferenceToLocal: AVAssetReferenceRestrictions { get }

    public static var forbidLocalReferenceToRemote: AVAssetReferenceRestrictions { get }

    public static var forbidCrossSiteReference: AVAssetReferenceRestrictions { get }

    public static var forbidLocalReferenceToLocal: AVAssetReferenceRestrictions { get }

    public static var forbidAll: AVAssetReferenceRestrictions { get }

    public static var defaultPolicy: AVAssetReferenceRestrictions { get }
}

Здесь нет опции как AVAssetReferenceRestrictionForbidNone.Но в документации прямо сказано, что так и есть.Итак, кто здесь виноват, или это недоразумение с моей стороны?

Часть 3: Как я здесь закончил?

У меня былоизучить их, потому что мы смогли выбрать видео из UIImagePickerController, а затем экспортировать его в форму AVURLAsset для использования в AVAssetExportSession.Все было хорошо, до iOS 13.0 работало без проблем.Эта функция работает на устройствах с iOS 12.4.1 и ниже.

Использование AVAssetReferenceRestrictions используется в инициализаторе AVURLAsset, и я считаю, что значение по умолчанию изменилось и не позволяет намэкспорт больше.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...