huiping192 / HPRTMP

HPRTMP is a Swift library for RTMP streaming, with an easy-to-use API, efficient message handling, and robust error recovery.
MIT License
16 stars 3 forks source link
rtmp swift

HPRTMP

CI License: MIT Twitter

Goals

The main goals of this library are:

Features

Requirements

Installation

You can install HPRTMP using Swift Package Manager by adding the following line to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/huiping192/HPRTMP.git", from: "0.0.1")
]

Alternatively, you can clone this repository and use the included HPRTMP.xcodeproj file, or you can copy the source files directly into your project.

Usage

Publishing Example

let session = RTMPPublishSession()
session.delegate = self

// Configure the session
let configure = PublishConfigure()
session.publish(url: "rtmp://your.rtmp.server/app/key", configure: configure)

// Send audio and video headers
session.publishAudioHeader(data: audioHeaderData)
session.publishVideoHeader(data: videoHeaderData, time: 0)

// Publish audio and video data
session.publishAudio(data: audioData, delta: delta)
session.publishVideo(data: videoData, delta: delta)

// Invalidate the session when done
session.invalidate()

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

HPRTMP is available under the MIT license. See the LICENSE file for more information.