Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/noise-cancellation-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@stream-io/react-native-webrtc": "125.4.4",
"react": "19.1.0",
"react-native": "^0.81.4",
"react-native-builder-bob": "^0.37.0",
"react-native-builder-bob": "^0.40.13",
"rimraf": "^6.0.1",
"typescript": "^5.9.3"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-broadcast/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
70 changes: 70 additions & 0 deletions packages/react-native-broadcast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# react-native-broadcast

a

## Installation

```sh
npm install react-native-broadcast
```

## Usage

### BroadcastVideoView Component

Display the local video preview from the broadcast mixer:

```tsx
import { BroadcastVideoView, multiply } from 'react-native-broadcast';
import { View, StyleSheet, Button } from 'react-native';

function App() {
const startBroadcast = async () => {
// This will initialize the mixer and start the RTMP broadcast
await multiply(3, 7);
};

return (
<View style={styles.container}>
<BroadcastVideoView style={styles.video} />
<Button title="Start Broadcast" onPress={startBroadcast} />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
video: {
flex: 1,
backgroundColor: 'black',
},
});
```

### API

#### `BroadcastVideoView`

A native view component that displays the local video from the broadcast mixer.

**Props:**

- `style?: ViewStyle` - Standard React Native style prop

The view automatically connects to the mixer when it becomes available after calling `multiply()` to start the broadcast.

## Contributing

- [Development workflow](CONTRIBUTING.md#development-workflow)
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
- [Code of conduct](CODE_OF_CONDUCT.md)

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
26 changes: 26 additions & 0 deletions packages/react-native-broadcast/StreamReactNativeBroadcast.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "StreamReactNativeBroadcast"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/GetStream/stream-video-js.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
s.private_header_files = "ios/**/*.h"

install_modules_dependencies(s)

spm_dependency(s,
url: 'https://github.com/HaishinKit/HaishinKit.swift',
requirement: { kind: 'upToNextMajorVersion', minimumVersion: '2.2.0' },
products: ['HaishinKit', 'RTMPHaishinKit', 'SRTHaishinKit', 'MoQTHaishinKit', 'RTCHaishinKit']
)
end
77 changes: 77 additions & 0 deletions packages/react-native-broadcast/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Broadcast_' + name]
}

repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:8.7.2"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
}
}


apply plugin: "com.android.library"
apply plugin: "kotlin-android"

apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Broadcast_" + name]).toInteger()
}

android {
namespace "com.broadcast"

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
}

buildFeatures {
buildConfig true
}

buildTypes {
release {
minifyEnabled false
}
}

lintOptions {
disable "GradleCompatible"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
main {
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}

repositories {
mavenCentral()
google()
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
5 changes: 5 additions & 0 deletions packages/react-native-broadcast/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Broadcast_kotlinVersion=2.0.21
Broadcast_minSdkVersion=24
Broadcast_targetSdkVersion=34
Broadcast_compileSdkVersion=35
Broadcast_ndkVersion=27.1.12297006
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.broadcast

import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.annotations.ReactModule

@ReactModule(name = BroadcastModule.NAME)
class BroadcastModule(reactContext: ReactApplicationContext) :
NativeBroadcastSpec(reactContext) {

override fun getName(): String {
return NAME
}

// Promise-based method to match TurboModule spec
override fun multiply(a: Double, b: Double, promise: Promise) {
try {
promise.resolve(a * b)
} catch (e: Exception) {
promise.reject("multiply_error", e)
}
}

companion object {
const val NAME = "Broadcast"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.broadcast

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import java.util.HashMap

class BroadcastPackage : BaseReactPackage() {
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
return if (name == BroadcastModule.NAME) {
BroadcastModule(reactContext)
} else {
null
}
}

override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
return ReactModuleInfoProvider {
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
moduleInfos[BroadcastModule.NAME] = ReactModuleInfo(
BroadcastModule.NAME,
BroadcastModule.NAME,
false, // canOverrideExistingModule
false, // needsEagerInit
false, // isCxxModule
true // isTurboModule
)
moduleInfos
}
}
}
12 changes: 12 additions & 0 deletions packages/react-native-broadcast/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
overrides: [
{
exclude: /\/node_modules\//,
presets: ['module:react-native-builder-bob/babel-preset'],
},
{
include: /\/node_modules\//,
presets: ['module:@react-native/babel-preset'],
},
],
};
Loading
Loading