You can create your own frame source by implementing
IBMWatsonMediaFrameSource and passing to
IBMWatsonMediaBroadcaster in its init method. Here are the main components of the protocol:
startCaptureWithCompletion:completionwill called by
IBMWatsonMediaBroadcasterto start to emitting frames. Call completion block once the frame sending is started or there was an error during the initialization process. If completion block returns with error
IBMWatsonMediaBroadcasterstate will set to
IBMWatsonMediaVideoBroadcasterStateInitialand error will be reported via
stopCapturecalls to the stop frame source.
IBMWatsonMediaCaptureConfig *preferredCaptureConfig describes ideal output format of video and audio frames that source should send to the broadcaster. It may change during the session. Note that sending video or audio frames with different format will cause conversion. Video frames with different aspect ratio will be scaled to fit to the preferred resolution with preserved original aspect ratio.
Frame source listener
id<IBMWatsonMediaFrameSourceListener> delegate provides methods to send audio or video frames, reporting error or custom events to the broadcaster.
If a video or audio frame was produced you can send to the broadcaster with
frameSource:didOutputSampleBuffer:(both video and audio) or
If an error happened and capturing cannot be continued you should call
frameSource:didFailWithError:. Broadcast will stop and
IBMWatsonMediaBroadcasterwill send a
didFailedWithError:to its delegate.