mmr

MMRtmp

Implement RTMP play/publish protocl on swift

Showing:

Popularity

Downloads/wk

0

GitHub Stars

36

Maintenance

Last Commit

3yrs ago

Contributors

0

Package

Dependencies

0

License

MIT

Categories

Readme

MMRtmp

CI Status Version License Platform

RTMP

  • Publish/Play (H264/AAC)
  • Action Message Format (AMF0/AMF3)

Demo

Play

Use RTMPPlayLayer class play rtmp video

  • Play Action

    displayLayer.play(host: "rtmp://184.72.239.149/vod", name: "BigBuckBunny_115k.mov")
    
  • Stop

     displayLayer.stop()
    
  • Seek

    displayLayer.seek(duration: 100)
    
  • Pause / UnPause

    displayLayer.pause()
    displayLayer.unPause()
    
  • Status Check

     displayLayer.playStatus { [unowned self] (status) in
        switch status {
        case .connect:
            self.pauseBtn.isHidden = false
            self.btnPlay.setTitle("Disconnected", for: .normal)
        case .failed(let err):
            print(err)
        case .unknown:
            self.pauseBtn.isHidden = true
        case .disconnected:
            self.btnPlay.setTitle("Play", for: .normal)
        case .pause:
            self.pauseBtn.setTitle("Resume", for: .normal)
        case .playStart:
            self.pauseBtn.setTitle("Pause", for: .normal)
            break
        }
    }
    

Publish

Use RTMPPublishLayer class publish video on server

  • Auth Layer

    publishLayer.authVideoAudio { (rc) in
        if !rc {
            let alert = UIAlertController.init(title: "Error", message: "you need auth your microphone and camera", preferredStyle: .alert)
            let action = UIAlertAction.init(title: "confirm", style: .default, handler: nil)
                alert.addAction(action)
        }
    }
    
  • Publish

        publishLayer.publish(host: host, name: name)
    
  • Stop

    publishLayer.publish(host: host, name: name)
    
  • Status Check

    publishLayer.publishStatus { (status) in
         switch status {
         case .unknown, .disconnected:
             self.btnConnect.setTitle("Publish", for: .normal)
         case .connect:
             self.btnConnect.setTitle("Disconnect", for: .normal)
         case .failed(_):
             self.btnConnect.setTitle("Publish", for: .normal)
         case .publishStart:
             break
         }
         }
    
  • VideoFPS

    publishLayer.videoFPS = 30
    
pod 'MMRtmp'

Author

MillmanY, millmanyang@gmail.com

License

MMRtmp is available under the MIT license. See the LICENSE file for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100