Update readme, add support to undefined callbacks

callkit-quick-and-dirty-test
Tiago Jacobs 3 years ago
parent 0bdde13982
commit b97e1d46fd

@ -18,8 +18,7 @@ import { BigBlueButtonMobile } from "bigbluebutton-mobile-sdk";
// ... // ...
<BigbluebuttonMobile <BigBlueButtonMobile
broadcastAppBundleId="org.bigbluebutton.mobile-sdk.example.BigbluebuttonMobileSdkBroadcastUploadExtension"
url="https://demo.bigbluebutton.org" url="https://demo.bigbluebutton.org"
style={styles.box} style={styles.box}
/> />

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { Alert, StyleSheet, Text, View } from 'react-native'; import { Alert, StyleSheet, Text, View } from 'react-native';
import { BigbluebuttonMobile } from 'bigbluebutton-mobile-sdk'; import { BigBlueButtonMobile } from 'bigbluebutton-mobile-sdk';
import type { INativeEvent } from './types'; import type { INativeEvent } from './types';
export default function App() { export default function App() {
@ -32,7 +32,7 @@ export default function App() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{loadComponent ? ( {loadComponent ? (
<BigbluebuttonMobile <BigBlueButtonMobile
url="https://mobile.bbb.imdt.dev" url="https://mobile.bbb.imdt.dev"
style={styles.bbb} style={styles.bbb}
onError={(content: any) => handleOnError(content)} onError={(content: any) => handleOnError(content)}

@ -64,6 +64,11 @@ open class ScreenBroadcaster {
let imageBuffer:CVImageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)! let imageBuffer:CVImageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)!
let timeStampNs: Int64 = Int64(CMTimeGetSeconds(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)) * 1000000000) let timeStampNs: Int64 = Int64(CMTimeGetSeconds(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)) * 1000000000)
let rtcPixlBuffer = RTCCVPixelBuffer(pixelBuffer: imageBuffer) let rtcPixlBuffer = RTCCVPixelBuffer(pixelBuffer: imageBuffer)
if(!webRTCClient.getIsRatioDefined()) {
webRTCClient.setRatio(originalWidth: rtcPixlBuffer.width, originalHeight: rtcPixlBuffer.height)
}
let rtcVideoFrame = RTCVideoFrame(buffer: rtcPixlBuffer, rotation: ._0, timeStampNs: timeStampNs) let rtcVideoFrame = RTCVideoFrame(buffer: rtcPixlBuffer, rotation: ._0, timeStampNs: timeStampNs)
self.webRTCClient.push(videoFrame: rtcVideoFrame) self.webRTCClient.push(videoFrame: rtcVideoFrame)
self.logger.info("video pushed") self.logger.info("video pushed")

@ -38,6 +38,7 @@ open class WebRTCClient: NSObject {
private var videoSource: RTCVideoSource? private var videoSource: RTCVideoSource?
private var videoCapturer: RTCVideoCapturer? private var videoCapturer: RTCVideoCapturer?
private var localVideoTrack: RTCVideoTrack? private var localVideoTrack: RTCVideoTrack?
private var isRatioDefined:Bool=false
@available(*, unavailable) @available(*, unavailable)
override init() { override init() {
@ -134,17 +135,24 @@ open class WebRTCClient: NSObject {
}*/ }*/
private func createVideoTrack() -> RTCVideoTrack { private func createVideoTrack() -> RTCVideoTrack {
let targetWidth:Int32 = 600;
let targetHeight:Int32 = targetWidth * Int32(UIScreen.main.fixedCoordinateSpace.bounds.height / UIScreen.main.fixedCoordinateSpace.bounds.width)
videoSource = WebRTCClient.factory.videoSource(forScreenCast: true) videoSource = WebRTCClient.factory.videoSource(forScreenCast: true)
videoCapturer = RTCVideoCapturer(delegate: videoSource!) videoCapturer = RTCVideoCapturer(delegate: videoSource!)
videoSource!.adaptOutputFormat(toWidth: targetWidth, height: targetHeight, fps: 15)
let videoTrack = WebRTCClient.factory.videoTrack(with: videoSource!, trackId: "video0") let videoTrack = WebRTCClient.factory.videoTrack(with: videoSource!, trackId: "video0")
videoTrack.isEnabled = true videoTrack.isEnabled = true
return videoTrack return videoTrack
} }
public func setRatio(originalWidth: Int32, originalHeight: Int32) {
let targetWidth:Int32 = 600;
let targetHeight:Int32 = targetWidth * Int32(originalHeight / originalWidth)
videoSource!.adaptOutputFormat(toWidth: targetWidth, height: targetHeight, fps: 15)
self.isRatioDefined = true;
}
public func getIsRatioDefined() -> Bool {
return self.isRatioDefined;
}
} }
// MARK: RTCPeerConnectionDelegate Methods // MARK: RTCPeerConnectionDelegate Methods

@ -1,6 +1,6 @@
{ {
"name": "bigbluebutton-mobile-sdk", "name": "bigbluebutton-mobile-sdk",
"version": "0.1.9", "version": "0.1.10",
"description": "This repository contains BigBlueButton react-native component, that's used in our [sample implementation](https://github.com/bigbluebutton/bigbluebutton-mobile).", "description": "This repository contains BigBlueButton react-native component, that's used in our [sample implementation](https://github.com/bigbluebutton/bigbluebutton-mobile).",
"main": "lib/commonjs/index", "main": "lib/commonjs/index",
"module": "lib/module/index", "module": "lib/module/index",

@ -19,7 +19,7 @@ const renderPlatformSpecificComponents = () =>
android: null, android: null,
}); });
export const BigbluebuttonMobile = ({ export const BigBlueButtonMobile = ({
url, url,
style, style,
onError, onError,
@ -45,9 +45,9 @@ export const BigbluebuttonMobile = ({
onLoadEnd={(content: any) => { onLoadEnd={(content: any) => {
/*in case of success, the property code is not defined*/ /*in case of success, the property code is not defined*/
if (typeof content.nativeEvent.code !== 'undefined') { if (typeof content.nativeEvent.code !== 'undefined') {
onError(content); if (onError) onError(content);
} else { } else {
onSuccess(content); if (onSuccess) onSuccess(content);
} }
}} }}
/> />

Loading…
Cancel
Save