Latest 1.0.0
Homepage https://github.com/MillmanY/MMRtmp
License MIT
Platforms ios 10.0
Authors

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, [email protected]

License

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

Latest podspec

{
    "name": "MMRtmp",
    "version": "1.0.0",
    "summary": "RTMP protocl on swift",
    "description": "Implement RTMP play/publish protocl on swift",
    "homepage": "https://github.com/MillmanY/MMRtmp",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "MillmanY": "[email protected]"
    },
    "source": {
        "git": "https://github.com/MillmanY/MMRtmp.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "MMRtmp/Classes/**/*"
}

Pin It on Pinterest

Share This