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
broadcastAppBundleId="org.bigbluebutton.mobile-sdk.example.BigbluebuttonMobileSdkBroadcastUploadExtension"
<BigBlueButtonMobile
url="https://demo.bigbluebutton.org"
style={styles.box}
/>

@ -1,7 +1,7 @@
import * as React from 'react';
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';
export default function App() {
@ -32,7 +32,7 @@ export default function App() {
return (
<View style={styles.container}>
{loadComponent ? (
<BigbluebuttonMobile
<BigBlueButtonMobile
url="https://mobile.bbb.imdt.dev"
style={styles.bbb}
onError={(content: any) => handleOnError(content)}

@ -64,6 +64,11 @@ open class ScreenBroadcaster {
let imageBuffer:CVImageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)!
let timeStampNs: Int64 = Int64(CMTimeGetSeconds(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)) * 1000000000)
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)
self.webRTCClient.push(videoFrame: rtcVideoFrame)
self.logger.info("video pushed")

@ -38,6 +38,7 @@ open class WebRTCClient: NSObject {
private var videoSource: RTCVideoSource?
private var videoCapturer: RTCVideoCapturer?
private var localVideoTrack: RTCVideoTrack?
private var isRatioDefined:Bool=false
@available(*, unavailable)
override init() {
@ -134,17 +135,24 @@ open class WebRTCClient: NSObject {
}*/
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)
videoCapturer = RTCVideoCapturer(delegate: videoSource!)
videoSource!.adaptOutputFormat(toWidth: targetWidth, height: targetHeight, fps: 15)
let videoTrack = WebRTCClient.factory.videoTrack(with: videoSource!, trackId: "video0")
videoTrack.isEnabled = true
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

@ -1,6 +1,6 @@
{
"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).",
"main": "lib/commonjs/index",
"module": "lib/module/index",

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

Loading…
Cancel
Save