[rtmp] 简介

117 阅读1分钟

节选[librtmp.3]

协议分析【个人理解】

  • rtmpdump (1)

some sample servers, and a library used to provide programmatic access to the RTMP protocol. This man page gives an overview of the RTMP library routines. These routines are found in the -lrtmp library. Many other routines are also available, but they are not documented yet.

new 一个会话句柄

  • RTMP_Alloc ()

A session handle is created using RTMP_Alloc ()

初始化

  • RTMP_Init ()

initialized

设置rtmp 指针和用于通信的url

  • RTMP_SetupURL ()

All session parameters are provided using

c/s连接

  • RTMP_Connect ()

The network connection is established using

建立会话

  • RTMP_ConnectStream() and then the RTMP session is established using

读流

  • RTMP_Read()

The stream is read using

推流->客户端推流

  • RTMP_EnableWrite()

A client can publish a stream by calling

NOTE: 建立连接的流程

  • before the
  • .BR RTMP_Connect ()
  • call, and then using
  • .BR RTMP_Write ()
  • after the session is established.
  • 暂停直播流

  • RTMP_Pause()

While a stream is playing it may be paused and unpaused using RTMP_Pause()

回放的时候:快进,快退

  • RTMP_Seek()

The stream playback position can be moved using RTMP_Seek()

关闭流

  • RTMP_Close()

When RTMP_Read () returns 0 bytes, the stream is complete and may be closed using RTMP_Close()

释放会话

  • RTMP_Free()

The session handle is freed using RTMP_Free()