sxudan / react-native-live-file-publisher

This is a react native package to publish file to RTSP or RTMP server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-live-file-publisher

This is a file publisher to publish the video file to RTSP or RTMP server.

Features

  • Publish video file streams to RTSP or RTMP servers.
  • Easy integration into your Flutter applications.

Installation

npm install react-native-live-file-publisher

or

yarn add react-native-live-file-publisher

Usage

import {
  PublisherProtocol,
  useLiveFilePublisher,
} from 'react-native-live-file-publisher';

// ...

const { publishingState, publish, stop, log } = useLiveFilePublisher({
    url: 'rtmp://192.168.1.100:1935',
    mode: PublisherProtocol.RTMP,
  });

.
.
// publish
/**
timestamp: '00:00:00'
filepath: local file path
name: stream name
**/
try {
    publish(<filepath>, <name>, <timestamp>);
} catch (e) {
    console.log(e);
}

Enums

export enum PublisherProtocol {
  RTMP,
  RTSP_UDP,
  RTSP_TCP,
}

export enum PublishingState {
  Normal = 'Normal',
  RequestPublish = 'RequestPublish',
  Publishing = 'Publishing',
  RequestStopPublish = 'RequestStopPublish',
}

Known issues

There are some issues publishing iphone video which are in HEVC format. They need to be transcoded using iOS UIImagePicker compression or other compression techniques. Before publishing to the server, you need to shrink resolution to streaming video resolution (1280x720). By default, the package expo-image-picker does it for you.

Screenshots

Publishing with the example app

Playing in VLC player

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

About

This is a react native package to publish file to RTSP or RTMP server.

License:MIT License


Languages

Language:TypeScript 37.1%Language:Kotlin 21.0%Language:Ruby 14.5%Language:JavaScript 13.1%Language:Objective-C++ 12.3%Language:Objective-C 1.5%Language:Swift 0.5%