BCOVPlaybackControllerViewStrategy Block Reference

Declared in BCOVPlaybackController.h

Block Definition


Typedef for a view strategy given to a playback controller to construct its view property.

typedef UIView* (^BCOVPlaybackControllerViewStrategy) (UIView *view, id <, BCOVPlaybackController >, playbackController )


Typedef for a view strategy given to a playback controller to construct its view property.

A view strategy is simply a block that takes two parameters, a UIView and a BCOVPlaybackController, and returns a UIView. It is used to compose UIView objects to create a view hierarchy that will ultimately be accessible from a BCOVPlaybackController’s view property. To construct your own view strategy, simply implement a block conforming to this signature and within the block, assemble the view hierarchy as you require. For example, you might want to insert custom controls into the view strategy you use when creating a playback controller:

BCOVPlaybackControllerViewStrategy vs = ^ UIView * (UIView *videoView, id playbackController) {

videoView.frame = myFrame;

MyControlsView *controls = [[MyControlsView alloc] initWithVideoView:videoView]; [playbackController addSessionConsumer:controls];

return controls;


This example view strategy, when given to a playback controller, will instruct the controller to return the MyControlsView instead of whatever view it would otherwise have returned from its view property (that view is the videoView parameter to the block). Note how this code adds the MyControlsView object as a session consumer to the session consumer container that is also passed into the block. Not every object will need to be added as a session consumer, but for controls or other views that care about the current playback session, it probably makes sense to conform to the BCOVPlaybackSessionConsumer protocol and pass it in, so as to be able to take action when a new session is delivered.

Declared In