The main goals of this library are:
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.
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()
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
HPRTMP is available under the MIT license. See the LICENSE file for more information.