Usage examples
// set access token provider so mobile SDK will be able to retrieve access token when needed.
AccessTokenProvider accessTokenProvider = new AccessTokenProviderImpl();
/* sniffing cameras */
CameraSniffer cameraSniffer = new CameraSniffer(getContext(), new CameraSnifferListenerImpl());
cameraSniffer.setProvider(accessTokenProvider);
cameraSniffer.startSniffing();
/* adding camera */
CameraWizard cameraWizard = new CameraWizard(new CameraWizardListenerImpl());
cameraWizard.setProvider(accessTokenProvider);
cameraWizard.addDevice(someDeviceReturnedBySniffer, "My awesome camera", 1234);
/* streaming live video */
// init live streamer item
long cameraId = 1234;
StreamerItem streamerItem = StreamerItem.createItem(cameraId);
// init recording streamer item
long cameraId = 1234;
long recordingId = 5678;
StreamerItem streamerItem = StreamerItem.createItem(cameraId, recordingId);
// init streamer
CameraStreamer cameraStreamer = new CameraStreamer(getContext(), surface);
cameraStreamer.setCameraStreamerListener(new CameraStreamerListenerImpl());
cameraStreamer.setProvider(accessTokenProvider);
// set streamer item
cameraStreamer.setStreamerItem(streamerItem);
// the streamer will start playing after the streamer item is ready
cameraStreamer.play();
// seek to middle of recording
cameraStreamer.seekTo(streamer.getDuration() / 2 );
Demo app includes implementation of multiview and fullscreen mode as well. Please note that there are a lot of ways to implement this feature. Take you project architecture into consideration while using sample code.
Updated almost 2 years ago