Embedding a media presentation in a view

The Time Media UI framework supports lightweight embedding by providing two classes, TMediaPresenter and TMediaView, for embedding a media presentation in a view.


To embed a media presentation in a view, you create a TMediaPresenter and have the presenter create a view, which you then adopt into the view hierarchy. For example, to embed a movie presentation in a view:

  1. Instantiate the convenience player for a movie, TMovie, passing in a QuickTime movie sequence.
    If you want to embed an audio or MIDI presentation, create a TSound or TMIDI object instead.
  2. Create a media presenter, passing it the TMovie instance.
    You can pass the media presenter constructor any one of the convenience players, TMovie, TSound, or TMIDI.
  3. Have TMediaPresenter create a media view for the presentation.
  4. Adopt the media view into the view root.
When you create a media presenter, you pass it one of the convenience players (TMovie, TSound, or TMIDI).

Once embedded in a view, the presentation provides player controls for playing, recording, stopping, seeking, and adjusting the volume of the sequence:

Simple lightweight embedding
The template class TPlayerView<APlayer> provides a simple way to embed media presentations. With this template class, you simply instantiate a player view using one of the convenience players and adopt it into the view hierarchy. This approach is useful for quick prototyping and demonstrations. However, for production code, you should use the media presenters described above. For example, to embed a movie sequence:
  1. Create a TMovie with the movie file you want to play.
  2. Instantiate the template class TPlayerView<APlayer> with the TMovie.
  3. Create a view for the movie with TMovie::CreateView and adopt it into the view root.
TPlayerView<APlayer> works with TSound and TMIDI, as well as TMovie.
Using this template class is not as efficient as creating a media presentation and a media view. When you use the template class, the player is created and deleted every time the window containing the view is opened and closed. If you use the presentation and view, only the view is created and deleted.


If the sequence is recordable, a recording control is also enabled. You can create custom control panels using the standard CommonPoint control classes. See Chapter 15 "Time Media User Interface framework" for more information on creating custom control panels.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker