public class AVTubeManager extends Object
SystemCapability.Multimedia#MEDIA| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
AVTubeManager.ObserverFlag |
Provides flags for media tube observers.
|
static interface |
AVTubeManager.TubeObserver |
Provides callbacks to listen for media tube changes.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addTubeObserver(AVTubeManager.TubeObserver observer,
int usageScenes,
int flags) |
Registers a tube observer with this
AVTubeManager instance. |
Optional<AVTubeEx> |
createAVTubeEx(AVTube.SetInfo setInfo) |
Creates an
AVTubeEx instance of a specified type. |
Optional<AVTube.SetInfo> |
createTubeSet(int nameResId) |
Creates a
SetInfo instance for a media tube type with a specified resource ID of the type name. |
Optional<AVTube.SetInfo> |
createTubeSet(String name) |
Creates a
SetInfo instance for a media tube type. |
AVTube |
defaultTube() |
Obtains the default
AVTube instance. |
void |
deleteAVTubeEx(AVTubeEx avTubeEx) |
Removes a specified
AVTubeEx instance from this AVTubeManager instance. |
static AVTubeManager |
getInstance(Context context) |
Obtains an
AVTubeManager instance. |
Optional<AVTube> |
getTubeByIndex(int index) |
Obtains the
AVTube instance at a specified index. |
void |
insertAVTubeEx(AVTubeEx avTubeEx) |
Inserts an
AVTubeEx instance to this AVTubeManager instance. |
void |
removeTubeObserver(AVTubeManager.TubeObserver observer) |
Removes a specified observer from this
AVTubeManager instance. |
Optional<AVTube> |
tubeInUse(int usageScenes) |
Obtains the
AVTube instances that are being used in specific scenes. |
int |
tubeNumber() |
Obtains the number of all
AVTube instances. |
void |
useTube(AVTube tube,
int usageScenes) |
Sets an
AVTube instance for specific scenes. |
public static AVTubeManager getInstance(Context context)
AVTubeManager instance.context - Indicates the application context. If the same context is passed, this method returns
the same instance.AVTubeManager instance.NullPointerException - Throws this exception if context is null.public AVTube defaultTube()
AVTube instance.
The default AVTube instance always exists.
AVTube instance.public Optional<AVTube> getTubeByIndex(int index)
AVTube instance at a specified index.index - Indicates the instance index. The value must be greater than 0 and less than
tubeNumber(). If an invalid index is passed, an unexpected result may occur.AVTube instance at the specified index.public int tubeNumber()
AVTube instances.AVTube instances.public Optional<AVTube> tubeInUse(int usageScenes)
AVTube instances that are being used in specific scenes.usageScenes - Indicates the scenes.AVTube instances.public void useTube(AVTube tube, int usageScenes)
AVTube instance for specific scenes.
Before calling this method, you should ensure that the media tube supports the scenes.
tube - Indicates the specified AVTube instance.usageScenes - Indicates the scenes where the specified media tube to be used, which can be
AVTube.UsageScene#REAL_TIME_AUDIO, AVTube.UsageScene#REAL_TIME_VIDEO,
AVTube.UsageScene#USER_EXTENDED, or any combination of them.public void addTubeObserver(AVTubeManager.TubeObserver observer, int usageScenes, int flags)
AVTubeManager instance.observer - Indicates the observer to register, which is an AVTubeManager.TubeObserver instance.usageScenes - Indicates the scenes where the observed media tubes are used.flags - Indicates the observer flag. The value can be AVTubeManager.ObserverFlag#NO_FLAG or
AVTubeManager.ObserverFlag#IGNORE_FILTER. The latter means that the observer
listens for all media tubes managed by this AVTubeManager instance, regardless of
the usage scenes.public void removeTubeObserver(AVTubeManager.TubeObserver observer)
AVTubeManager instance.observer - Indicates the observer to remove.public Optional<AVTube.SetInfo> createTubeSet(String name)
SetInfo instance for a media tube type.name - Indicates the name of the type.SetInfo instance.public Optional<AVTube.SetInfo> createTubeSet(int nameResId)
SetInfo instance for a media tube type with a specified resource ID of the type name.nameResId - Indicates the resource ID of the type name.SetInfo instance.public Optional<AVTubeEx> createAVTubeEx(AVTube.SetInfo setInfo)
AVTubeEx instance of a specified type.setInfo - Indicates information about the media tube type.AVTubeEx instance of the type.public void insertAVTubeEx(AVTubeEx avTubeEx)
AVTubeEx instance to this AVTubeManager instance.avTubeEx - Indicates the AVTubeEx instance to insert.public void deleteAVTubeEx(AVTubeEx avTubeEx)
AVTubeEx instance from this AVTubeManager instance.avTubeEx - Indicates the AVTubeEx instance to remove.