AVMetadataObject Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 6.0 and later.
Declared in
AVMetadataObject.h

Overview

The AVMetadataObject class is an abstract class that defines the basic properties associated with a piece of metadata. These attributes reflect information either about the metadata itself or the media from which the metadata originated. Subclasses are responsible for providing appropriate values for each of the relevant properties.

You should not subclass AVMetadataObject directly. Instead, you use one of the defined subclasses provided by the AV Foundation framework. Similarly, you do not create instances of this class yourself but use an AVCaptureMetadataOutput object to retrieve them from the captured data.

Tasks

Getting the Type of Metadata

Getting the Media-Related Attributes

Properties

bounds

The bounding rectangle associated with the metadata. (read-only)

@property(readonly) CGRect bounds
Discussion

The bounding rectangle is specified relative to the picture or video of the corresponding media. The rectangle’s origin is always specified in the top-left corner, and the x and y axis extend down and to the right.

If the metadata has no bounding rectangle, the value of this property should be CGRectZero.

For video content, the bounding rectangle may be expressed using scalar values in the range 0.0 to 1.0. Scalar values remain meaningful even when the original video has been scaled down.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVMetadataObject.h

duration

The duration of the media associated with this metadata object. (read-only)

@property(readonly) CMTime duration
Discussion

For metadata originating from a sample buffer (CMSampleBufferRef), the duration reflects the duration of the sample buffer. If there is no valid duration value associated with the metadata, this property should contain kCMTimeInvalid.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVMetadataObject.h

time

The media time value associated with the metadata object. (read-only)

@property(readonly) CMTime time
Discussion

For captured media, this property represents the time when the metadata was captured. For metadata originating from a sample buffer (CMSampleBufferRef), the time is the sample buffer’s presentation time. If there is no valid time value associated with the metadata, this property should contain kCMTimeInvalid.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVMetadataObject.h

type

The type of the metadata. (read-only)

@property(readonly) NSString *type
Discussion

You use this string to distinguish between different types of metadata. The possible values for this property are defined by subclasses, which can define constants for the type of metadata they represent.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVMetadataObject.h