Skip to content

Commit c3e10c8

Browse files
feat: add demo to stream to a RTMP link
1 parent 9c72045 commit c3e10c8

File tree

269 files changed

+17818
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+17818
-0
lines changed

demo/StreamRtmp/.bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

demo/StreamRtmp/.env

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
API_URL=
2+
APP_ENV=development
3+
CODEPUSH_KEY_IOS=
4+
CODEPUSH_KEY_ANDROID=
5+
APP_ID=com.saigontechnology.streamrtmp.development
6+
APP_NAME=BaseDev
7+
PROJECT_NAME=StreamRtmp
8+
9+
#Config for codepush and build
10+
APPCENTER_TOKEN_ANDROID=
11+
APPCENTER_TOKEN_IOS=
12+
APPCENTER_APP_NAME_ANDROID=
13+
APPCENTER_APP_NAME_IOS=
14+
APPCENTER_APP_DISPLAY_NAME=
15+
APPCENTER_RELEASE_NOTE=
16+
APPCENTER_DISTRIBUTE_DESTINATIONS=Public
17+
APPLE_TEAM_ID=

demo/StreamRtmp/.env.development

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
API_URL=
2+
APP_ENV=development
3+
CODEPUSH_KEY_IOS=
4+
CODEPUSH_KEY_ANDROID=
5+
APP_ID=com.saigontechnology.streamrtmp.development
6+
APP_NAME=BaseDevelopment
7+
PROJECT_NAME=StreamRtmp
8+
9+
#Config for codepush and build
10+
APPCENTER_TOKEN_ANDROID=
11+
APPCENTER_TOKEN_IOS=
12+
APPCENTER_APP_NAME_ANDROID=
13+
APPCENTER_APP_NAME_IOS=
14+
APPCENTER_APP_DISPLAY_NAME=
15+
APPCENTER_RELEASE_NOTE=
16+
APPCENTER_DISTRIBUTE_DESTINATIONS=Public
17+
APPLE_TEAM_ID=

demo/StreamRtmp/.env.production

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
API_URL=
2+
APP_ENV=production
3+
CODEPUSH_KEY_IOS=
4+
CODEPUSH_KEY_ANDROID=
5+
APP_ID=com.saigontechnology.streamrtmp
6+
APP_NAME=Base
7+
8+
#Config for codepush and build
9+
APPCENTER_TOKEN_ANDROID=
10+
APPCENTER_TOKEN_IOS=
11+
APPCENTER_APP_NAME_ANDROID=
12+
APPCENTER_APP_NAME_IOS=
13+
APPCENTER_APP_DISPLAY_NAME=
14+
APPCENTER_RELEASE_NOTE=
15+
APPCENTER_DISTRIBUTE_DESTINATIONS=Public
16+
APPLE_TEAM_ID=

demo/StreamRtmp/.env.staging

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
API_URL=
2+
APP_ENV=staging
3+
CODEPUSH_KEY_IOS=
4+
CODEPUSH_KEY_ANDROID=
5+
APP_ID=com.saigontechnology.streamrtmp.staging
6+
APP_NAME=BaseStaging
7+
8+
#Config for codepush and build
9+
APPCENTER_TOKEN_ANDROID=
10+
APPCENTER_TOKEN_IOS=
11+
APPCENTER_APP_NAME_ANDROID=
12+
APPCENTER_APP_NAME_IOS=
13+
APPCENTER_APP_DISPLAY_NAME=
14+
APPCENTER_RELEASE_NOTE=
15+
APPCENTER_DISTRIBUTE_DESTINATIONS=Public
16+
APPLE_TEAM_ID=

demo/StreamRtmp/.eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'@react-native',
5+
'eslint:recommended',
6+
'plugin:react/recommended',
7+
'plugin:react-hooks/recommended',
8+
'plugin:@typescript-eslint/eslint-recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
],
11+
parser: '@typescript-eslint/parser',
12+
plugins: ['@typescript-eslint', 'import', 'unused-imports'],
13+
overrides: [
14+
{
15+
files: ['*.ts', '*.tsx', '*.js'],
16+
rules: {
17+
semi: 'off',
18+
'comma-dangle': 'off',
19+
'no-shadow': 'off',
20+
'no-undef': 'off',
21+
'import/no-cycle': 'warn',
22+
'import/first': 'error',
23+
'import/no-duplicates': 'error',
24+
'unused-imports/no-unused-imports': 'error',
25+
'arrow-body-style': ['error', 'as-needed'],
26+
'@typescript-eslint/no-shadow': ['error'],
27+
'@typescript-eslint/no-empty-interface': 'warn',
28+
},
29+
},
30+
],
31+
}

demo/StreamRtmp/.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn pretty && yarn lint:fix

demo/StreamRtmp/.prettierrc.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
semi: false,
8+
printWidth: 110,
9+
}

demo/StreamRtmp/.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

demo/StreamRtmp/App.tsx

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import React, {useEffect} from 'react'
2+
import {LogBox, PermissionsAndroid, Text} from 'react-native'
3+
import {SafeAreaProvider} from 'react-native-safe-area-context'
4+
import {Provider} from 'react-redux'
5+
import {configureLocalization} from './src/locale/I18nConfig'
6+
import MainLayout from './src/MainLayout'
7+
import {injectStore} from './src/services/networking/axios'
8+
import {store, persistor} from './src/store/store'
9+
import {PersistGate} from 'redux-persist/integration/react'
10+
11+
interface TextWithDefaultProps extends Text {
12+
defaultProps?: {
13+
allowFontScaling?: boolean
14+
underlineColorAndroid?: 'transparent'
15+
}
16+
}
17+
/* eslint-disable @typescript-eslint/no-extra-semi */
18+
;(Text as unknown as TextWithDefaultProps).defaultProps = {
19+
...(Text as unknown as TextWithDefaultProps).defaultProps,
20+
allowFontScaling: false,
21+
underlineColorAndroid: 'transparent',
22+
}
23+
LogBox.ignoreAllLogs(true)
24+
25+
injectStore(store)
26+
configureLocalization('en')
27+
28+
/**
29+
* @name requestCameraAndAudioPermission
30+
* @description Function to request permission for Audio and Camera
31+
*/
32+
const requestCameraAndAudioPermission = async () => {
33+
try {
34+
const granted = await PermissionsAndroid.requestMultiple([
35+
PermissionsAndroid.PERMISSIONS.CAMERA,
36+
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
37+
])
38+
if (
39+
granted['android.permission.RECORD_AUDIO'] === PermissionsAndroid.RESULTS.GRANTED &&
40+
granted['android.permission.CAMERA'] === PermissionsAndroid.RESULTS.GRANTED
41+
) {
42+
console.log('You can use the cameras & mic')
43+
} else {
44+
console.log('Permission denied')
45+
}
46+
} catch (err) {
47+
console.warn(err)
48+
}
49+
}
50+
51+
function App(): React.JSX.Element {
52+
useEffect(() => {
53+
requestCameraAndAudioPermission()
54+
}, [])
55+
56+
return (
57+
<Provider store={store}>
58+
<PersistGate loading={null} persistor={persistor}>
59+
<SafeAreaProvider>
60+
<MainLayout />
61+
</SafeAreaProvider>
62+
</PersistGate>
63+
</Provider>
64+
)
65+
}
66+
67+
export default App

demo/StreamRtmp/Gemfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
source "https://rubygems.org"
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby ">= 2.6.10"
5+
6+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7+
# bound in the template on Cocoapods with next React Native release.
8+
gem 'cocoapods', '>= 1.13', '< 1.15'
9+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
10+
gem 'fastlane'
11+
12+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
13+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

demo/StreamRtmp/Gemfile.lock

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.7)
5+
base64
6+
nkf
7+
rexml
8+
activesupport (7.0.8.1)
9+
concurrent-ruby (~> 1.0, >= 1.0.2)
10+
i18n (>= 1.6, < 2)
11+
minitest (>= 5.1)
12+
tzinfo (~> 2.0)
13+
addressable (2.8.6)
14+
public_suffix (>= 2.0.2, < 6.0)
15+
algoliasearch (1.27.5)
16+
httpclient (~> 2.8, >= 2.8.3)
17+
json (>= 1.5.1)
18+
atomos (0.1.3)
19+
base64 (0.2.0)
20+
claide (1.1.0)
21+
cocoapods (1.14.3)
22+
addressable (~> 2.8)
23+
claide (>= 1.0.2, < 2.0)
24+
cocoapods-core (= 1.14.3)
25+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
26+
cocoapods-downloader (>= 2.1, < 3.0)
27+
cocoapods-plugins (>= 1.0.0, < 2.0)
28+
cocoapods-search (>= 1.0.0, < 2.0)
29+
cocoapods-trunk (>= 1.6.0, < 2.0)
30+
cocoapods-try (>= 1.1.0, < 2.0)
31+
colored2 (~> 3.1)
32+
escape (~> 0.0.4)
33+
fourflusher (>= 2.3.0, < 3.0)
34+
gh_inspector (~> 1.0)
35+
molinillo (~> 0.8.0)
36+
nap (~> 1.0)
37+
ruby-macho (>= 2.3.0, < 3.0)
38+
xcodeproj (>= 1.23.0, < 2.0)
39+
cocoapods-core (1.14.3)
40+
activesupport (>= 5.0, < 8)
41+
addressable (~> 2.8)
42+
algoliasearch (~> 1.0)
43+
concurrent-ruby (~> 1.1)
44+
fuzzy_match (~> 2.0.4)
45+
nap (~> 1.0)
46+
netrc (~> 0.11)
47+
public_suffix (~> 4.0)
48+
typhoeus (~> 1.0)
49+
cocoapods-deintegrate (1.0.5)
50+
cocoapods-downloader (2.1)
51+
cocoapods-plugins (1.0.0)
52+
nap
53+
cocoapods-search (1.0.1)
54+
cocoapods-trunk (1.6.0)
55+
nap (>= 0.8, < 2.0)
56+
netrc (~> 0.11)
57+
cocoapods-try (1.2.0)
58+
colored2 (3.1.2)
59+
concurrent-ruby (1.2.3)
60+
escape (0.0.4)
61+
ethon (0.16.0)
62+
ffi (>= 1.15.0)
63+
ffi (1.16.3)
64+
fourflusher (2.3.1)
65+
fuzzy_match (2.0.4)
66+
gh_inspector (1.1.3)
67+
httpclient (2.8.3)
68+
i18n (1.14.4)
69+
concurrent-ruby (~> 1.0)
70+
json (2.7.2)
71+
minitest (5.22.3)
72+
molinillo (0.8.0)
73+
nanaimo (0.3.0)
74+
nap (1.1.0)
75+
netrc (0.11.0)
76+
nkf (0.2.0)
77+
public_suffix (4.0.7)
78+
rexml (3.2.6)
79+
ruby-macho (2.5.1)
80+
typhoeus (1.4.1)
81+
ethon (>= 0.9.0)
82+
tzinfo (2.0.6)
83+
concurrent-ruby (~> 1.0)
84+
xcodeproj (1.24.0)
85+
CFPropertyList (>= 2.3.3, < 4.0)
86+
atomos (~> 0.1.3)
87+
claide (>= 1.0.2, < 2.0)
88+
colored2 (~> 3.1)
89+
nanaimo (~> 0.3.0)
90+
rexml (~> 3.2.4)
91+
92+
PLATFORMS
93+
ruby
94+
95+
DEPENDENCIES
96+
activesupport (>= 6.1.7.5, < 7.1.0)
97+
cocoapods (>= 1.13, < 1.15)
98+
99+
RUBY VERSION
100+
ruby 2.7.5p203
101+
102+
BUNDLED WITH
103+
2.1.4

demo/StreamRtmp/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
React Native RTMP Streaming Demo
2+
This repository demonstrates how to create a React Native app that connects to an RTMP (Real-Time Messaging Protocol) URL for live streaming. The app allows users to start a live video stream by connecting to an RTMP server, which is commonly used for video streaming platforms. This example covers the setup of video streaming using an RTMP-compatible video player in React Native and provides configuration guidance for connecting to an RTMP URL.
3+
4+
Features:
5+
6+
Connect and stream video to an RTMP URL
7+
Supports live video broadcast for streaming applications
8+
Technologies Used:
9+
10+
React Native
11+
RTMP streaming protocol
12+
13+
**Video Demo**

demo/StreamRtmp/__tests__/App.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native'
6+
import React from 'react'
7+
import App from '../App'
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer'
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />)
14+
})
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native'
6+
import React from 'react'
7+
import App from '../App'
8+
9+
// Note: import explicitly to use the types shipped with jest.
10+
import {it} from '@jest/globals'
11+
12+
// Note: test renderer must be required after react-native.
13+
import renderer from 'react-test-renderer'
14+
15+
it('renders correctly', () => {
16+
renderer.create(<App />)
17+
})

0 commit comments

Comments
 (0)