Mac OS X Reference Library Apple Developer Connection spyglass button

IMAVManager Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/InstantMessage.framework
Availability
Available in Mac OS X v10.5 and later.
Companion guide
Declared in
IMAVManager.h
Related sample code

Overview

The IMAVManager class is used to manage the state and configuration of auxiliary audio/video input to iChat AV—a feature that is called iChat Theater. There is only one shared instance of the IMAVManager class.

The IMAVManager shared object allows clients to provide audio and video to a running conference in iChat AV. Video is provided by supplying a data source object to receive periodic callbacks for individual frames, and audio is provided through an audio device and channel. The state of the shared IMAVManager object allows clients to configure the user interface appropriately.

Tasks

Creating an IMAVManager Object

Getting and Setting Properties

Starting and Stopping Audio/Video Content

Optimizing Audio/Video Performance

Managing Audio Channels

Sharing Files

Class Methods

sharedAVManager

Returns the shared instance of the IMAVManager object, creating it if the object doesn’t exist yet.

+ (IMAVManager *)sharedAVManager

Return Value

The shared IMAVManager object.

Availability
Related Sample Code
Declared In
IMAVManager.h

Instance Methods

audioDeviceChannels

Returns an array of audio device channel numbers used by the receiver.

- (NSArray *)audioDeviceChannels

Return Value

An array of audio device channel numbers. If the number of audio channels is set to 2, then the first number in the array is the left channel and the second number is the right channel. Returns nil if the receiver is not in the IMAVRunning state. Also returns nil if the setNumberOfAudioChannels: method is not invoked prior to invoking this method with 1 or 2 as the argument.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

audioDeviceUID

Returns the audio device UID.

- (NSString *)audioDeviceUID

Return Value

A valid UID when the receiver is in the IMAVRunning state; otherwise, nil. Also returns nil if the setNumberOfAudioChannels: method is not invoked prior to invoking this method with 1 or 2 as the argument.

Discussion

You can obtain the device by calling the AudioHardwareGetProperty function with the returned UID and the kAudioHardwarePropertyDeviceForUID constant as arguments.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

controlBar

Returns the receiver’s control bar.

- (IMAVControlBar *)controlBar

Return Value

The control bar configured for use by the receiver.

Availability
Related Sample Code
Declared In
IMAVManager.h

numberOfAudioChannels

Returns the number of audio channels.

- (NSInteger)numberOfAudioChannels

Return Value

The number of audio channels.

Availability
See Also
Declared In
IMAVManager.h

setNumberOfAudioChannels:

Sets the number of audio channels.

- (void)setNumberOfAudioChannels:(NSInteger)count

Parameters
count

The number of audio channels to configure. The allowed values are 0, 1, and 2. If 0, audio is disabled. If 1, audio is set to mono, and if 2, audio is stereo.

Discussion

Sets the number of audio channels that are configured after invoking start.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

setVideoDataSource:

Sets the receiver’s video data source object that provides video data to iChat AV.

- (void)setVideoDataSource:(id)dataSource

Parameters
dataSource

An object that conforms to the IMVideoDataSource informal protocol. The object needs to respond to either the renderIntoPixelBuffer:forTime: and getPixelBufferPixelFormat: methods, or therenderIntoOpenGLBuffer:onScreen:forTime: and getOpenGLBufferContext:pixelFormat: methods for OpenGL content. Any NSView object can also be a video data source. The Instant Message framework adds video rendering capabilities to NSView and all its subclasses. Pass nil to remove the receiver’s video data source. The data source is not retained by the receiver.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

setVideoOptimizationOptions:

Sets the video optimization options.

- (void)setVideoOptimizationOptions:(IMVideoOptimizationOptions)options

Parameters
options

Indicates the characteristics of the video content. Possible values are described in “IMVideoOptimizationOptions”.

Discussion

Use this method to give hints to the receiver about the type of video content so it can optimize the CPU and bandwidth usage.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

start

Starts sending audio and video to iChat AV.

- (void)start

Discussion

This method should be called when the receiver's state changes to IMAVRequested. If this method is successful, the receiver's state changes to IMAVRunning, after possibly changing momentarily to IMAVStartingUp and IMAVPending.

Before invoking this method, you need to set the video source using the setVideoDataSource: method to provide video content, or set the number of audio channels to greater than 0 using the setNumberOfAudioChannels: method to provide audio content; otherwise, this method raises an exception.

This method has no effect if invoked when the receiver is not in the IMAVRequested state.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

state

Returns the current state of the receiver.

- (IMAVManagerState)state

Return Value

The current state of the receiver set by iChat AV. See “IMAVManagerState” for a description of the possible return values.

Availability
Related Sample Code
Declared In
IMAVManager.h

stop

Stops sending audio and video to iChat AV.

- (void)stop

Discussion

After this method is invoked the state changes to IMAVRequested, after possibly changing momentarily to IMAVShuttingDown.

Availability
See Also
Related Sample Code
Declared In
IMAVManager.h

URLToShare

Returns the file URL of the document that the user chose to share over iChat Theater.

- (NSURL *)URLToShare

Return Value

Returns the file URL of the document or nil if the receiver's state is IMAVInactive. Also returns nil if the user chose this application to share audio/video without a document.

Availability
Declared In
IMAVManager.h

videoDataSource

Returns the receiver’s video data source object.

- (id)videoDataSource

Return Value

The receiver’s video data source, or nil if it is not set.

Availability
See Also
Declared In
IMAVManager.h

videoOptimizationOptions

Returns the video optimization options.

- (IMVideoOptimizationOptions)videoOptimizationOptions

Return Value

Video optimization options. Possible values are described in “IMVideoOptimizationOptions”.

Availability
See Also
Declared In
IMAVManager.h

Constants

IMAVManagerState

The state of an IMAVManager object.

enum {
   IMAVInactive        = 0,
   IMAVRequested       = 1,
   IMAVShuttingDown    = 2,
   IMAVStartingUp      = 3,
   IMAVPending         = 4,
   IMAVRunning         = 5
};
typedef NSUInteger IMAVManagerState;
Constants
IMAVInactive

An IMAVManager object is not available to send audio/video to iChat AV because the user has not started a session.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMAVRequested

The user selected this client to begin iChat Theater. The client should send start to the IMAVManager object to begin an iChat Theater session.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMAVStartingUp

An IMAVManager object is starting up and will soon change to the IMAVPending or IMAVRunning state.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMAVPending

iChat AV is not ready to receive content from an IMAVManager object.

An IMAVManager object may enter this state after the start method is invoked when iChat AV is not ready to receive audio/video content. This state may be followed by IMAVRunning at any point.

Typically, this state is entered if either the user does not yet have a video chat active or some internal processing or negotiation needs to take place before auxiliary audio/video input can begin. If the user does not have a video chat active, the state changes to IMAVRunning when a chat starts.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMAVRunning

An IMAVManager object is actively sending audio/video content to iChat AV.

You should not send audio/video content to an IMAVManager object until it reaches this state. For example, do not send audio/video content to an IMAVManager object immediately after sending start to the manager unless the manager is in this state.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMAVShuttingDown

An IMAVManager object is shutting down and will soon change to the IMAVInactive state.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

Declared In
InstantMessage/IMAVManager.h

IMVideoOptimizationOptions

The characteristics of the video source to allow for optimization of CPU and bandwidth usage.

enum {
   IMVideoOptimizationDefault = 0,
   IMVideoOptimizationStills = 1 << 0,
   IMVideoOptimizationReplacement = 1 << 1,
};
typedef NSUInteger IMVideoOptimizationOptions;
Constants
IMVideoOptimizationDefault

Shared video is played alongside the user's local video, and the video is full-motion. This is the default.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMVideoOptimizationStills

Set this flag if video will be largely static. This tells iChat Theater to attempt to optimize the video resolution for still images, rather than rapidly changing video.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

IMVideoOptimizationReplacement

Do not send the user's local video, instead devote full CPU and bandwidth resources to the shared video.

Available in Mac OS X v10.5 and later.

Declared in IMAVManager.h.

Declared In
InstantMessage/IMAVManager.h

Notifications

IMAVManagerStateChangedNotification

Posted by the IMService class custom notification center when the iChat AV input state changes.

The notification object is the shared IMAVManager object. This notification does not have a user information dictionary. Observers of this notification should send state to the shared IMAVManager object to get the new state.

When the user selects this application or one of its documents to share over iChat Theater, the state of the shared IMAVManager object changes to IMAVRequested and this notification is sent.

Availability
Declared In
IMAVManager.h

IMAVManagerURLToShareChangedNotification

Posted by the IMService class custom notification center when a new document is selected by the user to share over iChat Theater during a running session.

The notification object is the shared IMAVManager object. This notification does not have a user information dictionary. Observers of this notification should send URLToShare to the shared IMAVManager object to get the new document. This notification is not sent the first time the state of the shared IMAVManager object changes to IMAVRequested to begin the session.

Availability
Declared In
IMAVManager.h

Last updated: 2009-05-05

Did this document help you? Yes It's good, but... Not helpful...