rtmpplugin

package module
v0.0.0-...-6744f52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 19 Imported by: 0

README

rtmpplugin

the rtmp protocol plugin for monibuca

实现了RTMP Server的基本功能,即接收来自OBS、ffmpeg等推流器的rtmp协议推流。 实现了RTMP协议的播放,可供rtmp协议播放器拉流播放。

插件名称

RTMP

配置

[RTMP]
FirstScreen = false
ListenAddr = ":1935"
  • FirstScreen 代表是否打开首屏秒开
  • ListenAddr 代表监听的端口号

Documentation

Index

Constants

View Source
const (
	AMF0_NUMBER         = 0x00 // 浮点数
	AMF0_BOOLEAN        = 0x01 // 布尔型
	AMF0_STRING         = 0x02 // 字符串
	AMF0_OBJECT         = 0x03 // 对象,开始
	AMF0_MOVIECLIP      = 0x04
	AMF0_NULL           = 0x05 // null
	AMF0_UNDEFINED      = 0x06
	AMF0_REFERENCE      = 0x07
	AMF0_ECMA_ARRAY     = 0x08
	AMF0_END_OBJECT     = 0x09 // 对象,结束
	AMF0_STRICT_ARRAY   = 0x0A
	AMF0_DATE           = 0x0B // 日期
	AMF0_LONG_STRING    = 0x0C // 字符串
	AMF0_UNSUPPORTED    = 0x0D
	AMF0_RECORDSET      = 0x0E
	AMF0_XML_DOCUMENT   = 0x0F
	AMF0_TYPED_OBJECT   = 0x10
	AMF0_AVMPLUS_OBJECT = 0x11

	AMF3_UNDEFINED     = 0x00
	AMF3_NULL          = 0x01
	AMF3_FALSE         = 0x02
	AMF3_TRUE          = 0x03
	AMF3_INTEGER       = 0x04
	AMF3_DOUBLE        = 0x05
	AMF3_STRING        = 0x06
	AMF3_XML_DOC       = 0x07
	AMF3_DATE          = 0x08
	AMF3_ARRAY         = 0x09
	AMF3_OBJECT        = 0x0A
	AMF3_XML           = 0x0B
	AMF3_BYTE_ARRAY    = 0x0C
	AMF3_VECTOR_INT    = 0x0D
	AMF3_VECTOR_UINT   = 0x0E
	AMF3_VECTOR_DOUBLE = 0x0F
	AMF3_VECTOR_OBJECT = 0x10
	AMF3_DICTIONARY    = 0x11
)
View Source
const (
	RTMP_CHUNK_HEAD_12 = 0 << 6 // Chunk Basic Header = (Chunk Type << 6) | Chunk Stream ID.
	RTMP_CHUNK_HEAD_8  = 1 << 6
	RTMP_CHUNK_HEAD_4  = 2 << 6
	RTMP_CHUNK_HEAD_1  = 3 << 6
)
View Source
const (
	Response_OnStatus = "onStatus"
	Response_Result   = "_result"
	Response_Error    = "_error"

	/* Level */
	Level_Status  = "status"
	Level_Error   = "error"
	Level_Warning = "warning"

	/* Code */
	/* NetStream */
	NetStream_Play_Reset          = "NetStream.Play.Reset"          // "status" 由播放列表重置导致
	NetStream_Play_Start          = "NetStream.Play.Start"          // "status" 播放已开始
	NetStream_Play_StreamNotFound = "NetStream.Play.StreamNotFound" // "error"  无法找到传递给 play()方法的 FLV
	NetStream_Play_Stop           = "NetStream.Play.Stop"           // "status" 播放已结束
	NetStream_Play_Failed         = "NetStream.Play.Failed"         // "error"  出于此表中列出的原因之外的某一原因(例如订阅者没有读取权限),播放发生了错误

	NetStream_Play_Switch   = "NetStream.Play.Switch"
	NetStream_Play_Complete = "NetStream.Play.Switch"

	NetStream_Data_Start = "NetStream.Data.Start"

	NetStream_Publish_Start     = "NetStream.Publish.Start"     // "status"	已经成功发布.
	NetStream_Publish_BadName   = "NetStream.Publish.BadName"   // "error"	试图发布已经被他人发布的流.
	NetStream_Publish_Idle      = "NetStream.Publish.Idle"      // "status"	流发布者空闲而没有在传输数据.
	NetStream_Unpublish_Success = "NetStream.Unpublish.Success" // "status"	已成功执行取消发布操作.

	NetStream_Buffer_Empty   = "NetStream.Buffer.Empty"   // "status" 数据的接收速度不足以填充缓冲区.数据流将在缓冲区重新填充前中断,此时将发送 NetStream.Buffer.Full 消息,并且该流将重新开始播放
	NetStream_Buffer_Full    = "NetStream.Buffer.Full"    // "status" 缓冲区已满并且流将开始播放
	NetStream_Buffe_Flush    = "NetStream.Buffer.Flush"   // "status" 数据已完成流式处理,剩余的缓冲区将被清空
	NetStream_Pause_Notify   = "NetStream.Pause.Notify"   // "status" 流已暂停
	NetStream_Unpause_Notify = "NetStream.Unpause.Notify" // "status" 流已恢复

	NetStream_Record_Start    = "NetStream.Record.Start"    // "status"	录制已开始.
	NetStream_Record_NoAccess = "NetStream.Record.NoAccess" // "error"	试图录制仍处于播放状态的流或客户端没有访问权限的流.
	NetStream_Record_Stop     = "NetStream.Record.Stop"     // "status"	录制已停止.
	NetStream_Record_Failed   = "NetStream.Record.Failed"   // "error"	尝试录制流失败.

	NetStream_Seek_Failed      = "NetStream.Seek.Failed"      // "error"	搜索失败,如果流处于不可搜索状态,则会发生搜索失败.
	NetStream_Seek_InvalidTime = "NetStream.Seek.InvalidTime" // "error"	对于使用渐进式下载方式下载的视频,用户已尝试跳过到目前为止已下载的视频数据的结尾或在整个文件已下载后跳过视频的结尾进行搜寻或播放. message.details 属性包含一个时间代码,该代码指出用户可以搜寻的最后一个有效位置.
	NetStream_Seek_Notify      = "NetStream.Seek.Notify"      // "status"	搜寻操作完成.

	/* NetConnect */
	NetConnection_Call_BadVersion     = "NetConnection.Call.BadVersion"     // "error"	以不能识别的格式编码的数据包.
	NetConnection_Call_Failed         = "NetConnection.Call.Failed"         // "error"	NetConnection.call 方法无法调用服务器端的方法或命令.
	NetConnection_Call_Prohibited     = "NetConnection.Call.Prohibited"     // "error"	Action Message Format (AMF) 操作因安全原因而被阻止. 或者是 AMF URL 与 SWF 不在同一个域,或者是 AMF 服务器没有信任 SWF 文件的域的策略文件.
	NetConnection_Connect_AppShutdown = "NetConnection.Connect.AppShutdown" // "error"	正在关闭指定的应用程序.
	NetConnection_Connect_InvalidApp  = "NetConnection.Connect.InvalidApp"  // "error"	连接时指定的应用程序名无效.
	NetConnection_Connect_Success     = "NetConnection.Connect.Success"     // "status"	连接尝试成功.
	NetConnection_Connect_Closed      = "NetConnection.Connect.Closed"      // "status"	成功关闭连接.
	NetConnection_Connect_Failed      = "NetConnection.Connect.Failed"      // "error"	连接尝试失败.
	NetConnection_Connect_Rejected    = "NetConnection.Connect.Rejected"    // "error"  连接尝试没有访问应用程序的权限.

	/* SharedObject */
	SharedObject_Flush_Success  = "SharedObject.Flush.Success"  //"status"	"待定"状态已解析并且 SharedObject.flush() 调用成功.
	SharedObject_Flush_Failed   = "SharedObject.Flush.Failed"   //"error"	"待定"状态已解析,但 SharedObject.flush() 失败.
	SharedObject_BadPersistence = "SharedObject.BadPersistence" //"error"	使用永久性标志对共享对象进行了请求,但请求无法被批准,因为已经使用其它标记创建了该对象.
	SharedObject_UriMismatch    = "SharedObject.UriMismatch"    //"error"	试图连接到拥有与共享对象不同的 URI (URL) 的 NetConnection 对象.
)
View Source
const (
	C1S1_SIZE = 1536

	C1S1_TIME_SIZE    = 4
	C1S1_VERSION_SIZE = 4

	C1S1_DIGEST_SIZE        = 764
	C1S1_DIGEST_OFFSET_SIZE = 4
	C1S1_DIGEST_OFFSET_MAX  = 764 - 32 - 4
	C1S1_DIGEST_DATA_SIZE   = 32

	C1S1_KEY_SIZE        = 764
	C1S1_KEY_OFFSET_SIZE = 4
	C1S1_KEY_OFFSET_MAX  = 764 - 128 - 4
	C1S1_KEY_DATA_SIZE   = 128

	RTMP_HANDSHAKE_VERSION = 0x03
)
View Source
const (

	// Chunk
	RTMP_MSG_CHUNK_SIZE = 1
	RTMP_MSG_ABORT      = 2

	// RTMP
	RTMP_MSG_ACK           = 3
	RTMP_MSG_USER_CONTROL  = 4
	RTMP_MSG_ACK_SIZE      = 5
	RTMP_MSG_BANDWIDTH     = 6
	RTMP_MSG_EDGE          = 7
	RTMP_MSG_AUDIO         = 8
	RTMP_MSG_VIDEO         = 9
	RTMP_MSG_AMF3_METADATA = 15
	RTMP_MSG_AMF3_SHARED   = 16
	RTMP_MSG_AMF3_COMMAND  = 17

	RTMP_MSG_AMF0_METADATA = 18
	RTMP_MSG_AMF0_SHARED   = 19
	RTMP_MSG_AMF0_COMMAND  = 20

	RTMP_MSG_AGGREGATE = 22

	RTMP_DEFAULT_CHUNK_SIZE = 128
	RTMP_MAX_CHUNK_SIZE     = 65536
	RTMP_MAX_CHUNK_HEADER   = 18

	// User Control Event
	RTMP_USER_STREAM_BEGIN       = 0
	RTMP_USER_STREAM_EOF         = 1
	RTMP_USER_STREAM_DRY         = 2
	RTMP_USER_SET_BUFFLEN        = 3
	RTMP_USER_STREAM_IS_RECORDED = 4
	RTMP_USER_PING_REQUEST       = 6
	RTMP_USER_PING_RESPONSE      = 7
	RTMP_USER_EMPTY              = 31

	// StreamID == (ChannelID-4)/5+1
	// ChannelID == Chunk Stream ID
	// StreamID == Message Stream ID
	// Chunk Stream ID == 0, 第二个byte + 64
	// Chunk Stream ID == 1, (第三个byte) * 256 + 第二个byte + 64
	// Chunk Stream ID == 2.
	// 2 < Chunk Stream ID < 64(2的6次方)
	RTMP_CSID_CONTROL = 0x02
	RTMP_CSID_COMMAND = 0x03
	RTMP_CSID_AUDIO   = 0x06
	RTMP_CSID_DATA    = 0x05
	RTMP_CSID_VIDEO   = 0x05
)
View Source
const (
	SEND_CHUNK_SIZE_MESSAGE         = "Send Chunk Size Message"
	SEND_ACK_MESSAGE                = "Send Acknowledgement Message"
	SEND_ACK_WINDOW_SIZE_MESSAGE    = "Send Window Acknowledgement Size Message"
	SEND_SET_PEER_BANDWIDTH_MESSAGE = "Send Set Peer Bandwidth Message"

	SEND_STREAM_BEGIN_MESSAGE       = "Send Stream Begin Message"
	SEND_SET_BUFFER_LENGTH_MESSAGE  = "Send Set Buffer Lengh Message"
	SEND_STREAM_IS_RECORDED_MESSAGE = "Send Stream Is Recorded Message"

	SEND_PING_REQUEST_MESSAGE  = "Send Ping Request Message"
	SEND_PING_RESPONSE_MESSAGE = "Send Ping Response Message"

	SEND_CONNECT_MESSAGE          = "Send Connect Message"
	SEND_CONNECT_RESPONSE_MESSAGE = "Send Connect Response Message"

	SEND_CREATE_STREAM_MESSAGE          = "Send Create Stream Message"
	SEND_CREATE_STREAM_RESPONSE_MESSAGE = "Send Create Stream Response Message"

	SEND_PLAY_MESSAGE          = "Send Play Message"
	SEND_PLAY_RESPONSE_MESSAGE = "Send Play Response Message"

	SEND_PUBLISH_RESPONSE_MESSAGE = "Send Publish Response Message"
	SEND_PUBLISH_START_MESSAGE    = "Send Publish Start Message"

	SEND_UNPUBLISH_RESPONSE_MESSAGE = "Send Unpublish Response Message"

	SEND_AUDIO_MESSAGE      = "Send Audio Message"
	SEND_FULL_AUDIO_MESSAGE = "Send Full Audio Message"
	SEND_VIDEO_MESSAGE      = "Send Video Message"
	SEND_FULL_VDIEO_MESSAGE = "Send Full Video Message"
)

Variables

View Source
var (
	FMS_KEY = []byte{
		0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20,
		0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x6c,
		0x61, 0x73, 0x68, 0x20, 0x4d, 0x65, 0x64, 0x69,
		0x61, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
		0x20, 0x30, 0x30, 0x31,
		0xf0, 0xee, 0xc2, 0x4a, 0x80, 0x68, 0xbe, 0xe8,
		0x2e, 0x00, 0xd0, 0xd1, 0x02, 0x9e, 0x7e, 0x57,
		0x6e, 0xec, 0x5d, 0x2d, 0x29, 0x80, 0x6f, 0xab,
		0x93, 0xb8, 0xe6, 0x36, 0xcf, 0xeb, 0x31, 0xae,
	} // 68
	FP_KEY = []byte{
		0x47, 0x65, 0x6E, 0x75, 0x69, 0x6E, 0x65, 0x20,
		0x41, 0x64, 0x6F, 0x62, 0x65, 0x20, 0x46, 0x6C,
		0x61, 0x73, 0x68, 0x20, 0x50, 0x6C, 0x61, 0x79,
		0x65, 0x72, 0x20, 0x30, 0x30, 0x31,
		0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8,
		0x2E, 0x00, 0xD0, 0xD1, 0x02, 0x9E, 0x7E, 0x57,
		0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB,
		0x93, 0xB8, 0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE,
	} // 62
)
View Source
var END_OBJ = []byte{0, 0, AMF0_END_OBJECT}

Functions

func DecodeAMFObject

func DecodeAMFObject(obj interface{}, key string) interface{}

func GetRtmpMessage

func GetRtmpMessage(chunk *Chunk)

func HMAC_SHA256

func HMAC_SHA256(message []byte, key []byte) ([]byte, error)

HMAC运算利用哈希算法,以一个密钥和一个消息为输入,生成一个消息摘要作为输出 哈希算法sha256.New, 密钥 key, 消息 message.

func Handshake

func Handshake(brw *bufio.ReadWriter) error

func ListenRtmp

func ListenRtmp(addr string) error

func ReadBuf

func ReadBuf(r io.Reader, length int) (buf []byte)

Types

type AMF

type AMF struct {
	*bytes.Buffer
}

type AMFObject

type AMFObject interface{}

type AMFObjects

type AMFObjects map[string]AMFObject

type CURDStreamMessage

type CURDStreamMessage struct {
	CommandMessage
	StreamId uint32
}

Delete Stream Message NetStream sends the deleteStream command when the NetStream object is getting destroyed

func (*CURDStreamMessage) Encode0

func (msg *CURDStreamMessage) Encode0()

type CallMessage

type CallMessage struct {
	CommandMessage
	Object   interface{} `json:",omitempty"`
	Optional interface{} `json:",omitempty"`
}

Call Message. The call method of the NetConnection object runs remote procedure calls (RPC) at the receiving end. The called RPC name is passed as a parameter to the call command.

func (*CallMessage) Encode

func (msg *CallMessage) Encode() []byte

func (*CallMessage) Encode3

func (msg *CallMessage) Encode3() []byte

type Chunk

type Chunk struct {
	*ChunkHeader
	Body    []byte
	MsgData interface{}
}

func (*Chunk) Encode

func (c *Chunk) Encode(msg RtmpMessage)

func (*Chunk) Recycle

func (c *Chunk) Recycle()

type ChunkBasicHeader

type ChunkBasicHeader struct {
	ChunkStreamID uint32 `json:""` // 6 bit. 3 ~ 65559, 0,1,2 reserved
	ChunkType     byte   `json:""` // 2 bit.
}

Basic Header (1 to 3 bytes) : This field encodes the chunk stream ID and the chunk type. Chunk type determines the format of the encoded message header. The length(Basic Header) depends entirely on the chunk stream ID, which is a variable-length field.

type ChunkExtendedTimestamp

type ChunkExtendedTimestamp struct {
	ExtendTimestamp uint32 `json:",omitempty"` // 标识该字段的数据可忽略
}

Extended Timestamp (0 or 4 bytes): This field is present in certain circumstances depending on the encoded timestamp or timestamp delta field in the Chunk Message header. See Section 5.3.1.3 for more information

type ChunkHeader

func (*ChunkHeader) Clone

func (h *ChunkHeader) Clone() *ChunkHeader

type ChunkMessageHeader

type ChunkMessageHeader struct {
	Timestamp       uint32 `json:""` // 3 byte
	MessageLength   uint32 `json:""` // 3 byte
	MessageTypeID   byte   `json:""` // 1 byte
	MessageStreamID uint32 `json:""` // 4 byte
}

Message Header (0, 3, 7, or 11 bytes): This field encodes information about the message being sent (whether in whole or in part). The length can be determined using the chunk type specified in the chunk header.

type CommandMessage

type CommandMessage struct {
	CommandName   string // 命令名. 字符串. 命令名.设置为"connect"
	TransactionId uint64 // 传输ID. 数字. 总是设为1
}

Command Message

func (*CommandMessage) GetCommand

func (cmd *CommandMessage) GetCommand() *CommandMessage

type Commander

type Commander interface {
	GetCommand() *CommandMessage
}

type CreateStreamMessage

type CreateStreamMessage struct {
	CommandMessage
	Object interface{}
}

func (*CreateStreamMessage) Encode

func (msg *CreateStreamMessage) Encode() []byte

type HaveStreamID

type HaveStreamID interface {
	GetStreamID() uint32
}

type MetadataMessage

type MetadataMessage struct {
	Proterties map[string]interface{} `json:",omitempty"`
}

Message 15, 18. Data Message. The client or the server sends this message to send Metadata or any user data to the peer. Metadata includes details about the data(audio, video etc.) like creation time, duration, theme and so on. These messages have been assigned message type value of 18 for AMF0 and message type value of 15 for AMF3

type NetConnection

type NetConnection struct {
	*bufio.ReadWriter
	// contains filtered or unexported fields
}

func (*NetConnection) OnConnect

func (conn *NetConnection) OnConnect() (err error)

func (*NetConnection) RecvMessage

func (conn *NetConnection) RecvMessage() (msg *Chunk, err error)

func (*NetConnection) SendMessage

func (conn *NetConnection) SendMessage(message string, args interface{}) error

type NetStatusEvent

type NetStatusEvent struct {
	Code  string
	Level string
}

type PauseMessage

type PauseMessage struct {
	CommandMessage
	Pause        bool
	Milliseconds uint64
}

Pause Message The client sends the pause command to tell the server to pause or start playing.

func (*PauseMessage) Encode0

func (msg *PauseMessage) Encode0()

type PingRequestMessage

type PingRequestMessage struct {
	UserControlMessage
	Timestamp uint32
}

PingRequest (=6) The server sends this event to test whether the client is reachable. Event data is a 4-byte timestamp, representing the local server time when the server dispatched the command. The client responds with PingResponse on receiving MsgPingRequest.

func (*PingRequestMessage) Encode

func (msg *PingRequestMessage) Encode() (b []byte)

type Play2Message

type Play2Message struct {
	CommandMessage
	StartTime     uint64
	OldStreamName string
	StreamName    string
	Duration      uint64
	Transition    string
}

Play2 Message Unlike the play command, play2 can switch to a different bit rate stream without changing the timeline of the content played. The server maintains multiple files for all supported bitrates that the client can request in play2.

func (*Play2Message) Encode0

func (msg *Play2Message) Encode0()

type PlayMessage

type PlayMessage struct {
	CommandMessage
	StreamName string
	Start      uint64
	Duration   uint64
	Rest       bool
}

Play Message The client sends this command to the server to play a stream. A playlist can also be created using this command multiple times

func (*PlayMessage) Encode

func (msg *PlayMessage) Encode() []byte

type PublishMessage

type PublishMessage struct {
	CommandMessage
	PublishingName string
	PublishingType string
}

Publish Message The client sends the publish command to publish a named stream to the server. Using this name, any client can play this stream and receive the published audio, video, and data messages

func (*PublishMessage) Encode0

func (msg *PublishMessage) Encode0()

type RTMP

type RTMP struct {
	InputStream
}

type ReceiveAVMessage

type ReceiveAVMessage struct {
	CommandMessage
	BoolFlag bool
}

Receive Audio Message NetStream sends the receiveAudio message to inform the server whether to send or not to send the audio to the client

func (*ReceiveAVMessage) Encode0

func (msg *ReceiveAVMessage) Encode0()

type ResponseCallMessage

type ResponseCallMessage struct {
	CommandMessage
	Object   interface{}
	Response interface{}
}

Response Call Message

func (*ResponseCallMessage) Encode0

func (msg *ResponseCallMessage) Encode0() []byte

type ResponseConnectMessage

type ResponseConnectMessage struct {
	CommandMessage
	Properties interface{} `json:",omitempty"`
	Infomation interface{} `json:",omitempty"`
}

Response Connect Message

func (*ResponseConnectMessage) Encode

func (msg *ResponseConnectMessage) Encode() []byte

type ResponseCreateStreamMessage

type ResponseCreateStreamMessage struct {
	CommandMessage
	Object   interface{} `json:",omitempty"`
	StreamId uint32
}

Response Create Stream Message

func (*ResponseCreateStreamMessage) Decode0

func (msg *ResponseCreateStreamMessage) Decode0(chunk *Chunk)

func (*ResponseCreateStreamMessage) Decode3

func (msg *ResponseCreateStreamMessage) Decode3(chunk *Chunk)

func (*ResponseCreateStreamMessage) Encode

func (msg *ResponseCreateStreamMessage) Encode() []byte

type ResponseMessage

type ResponseMessage struct {
	CommandMessage
	Properties  interface{} `json:",omitempty"`
	Infomation  interface{} `json:",omitempty"`
	Description string
}

Response Message

func (*ResponseMessage) Decode0

func (msg *ResponseMessage) Decode0(chunk *Chunk)

func (*ResponseMessage) Encode0

func (msg *ResponseMessage) Encode0()

type ResponsePauseMessage

type ResponsePauseMessage struct {
	CommandMessage
	Description string
}

Response Pause Message

func (*ResponsePauseMessage) Encode0

func (msg *ResponsePauseMessage) Encode0()

type ResponsePlayMessage

type ResponsePlayMessage struct {
	CommandMessage
	Object      interface{} `json:",omitempty"`
	Description string
	StreamID    uint32
}

Response Play Message

func (*ResponsePlayMessage) Decode0

func (msg *ResponsePlayMessage) Decode0(chunk *Chunk)

func (*ResponsePlayMessage) Decode3

func (msg *ResponsePlayMessage) Decode3(chunk *Chunk)

func (*ResponsePlayMessage) Encode

func (msg *ResponsePlayMessage) Encode() []byte

func (*ResponsePlayMessage) GetStreamID

func (msg *ResponsePlayMessage) GetStreamID() uint32

type ResponsePublishMessage

type ResponsePublishMessage struct {
	CommandMessage
	Properties interface{} `json:",omitempty"`
	Infomation interface{} `json:",omitempty"`
	StreamID   uint32
}

Response Publish Message

func (*ResponsePublishMessage) Encode

func (msg *ResponsePublishMessage) Encode() []byte

func (*ResponsePublishMessage) GetStreamID

func (msg *ResponsePublishMessage) GetStreamID() uint32

type ResponseSeekMessage

type ResponseSeekMessage struct {
	CommandMessage
	Description string
}

Response Seek Message

func (*ResponseSeekMessage) Encode0

func (msg *ResponseSeekMessage) Encode0()

type RtmpMessage

type RtmpMessage interface {
	Encode() []byte
}

type SeekMessage

type SeekMessage struct {
	CommandMessage
	Milliseconds uint64
}

Seek Message The client sends the seek command to seek the offset (in milliseconds) within a media file or playlist.

func (*SeekMessage) Encode0

func (msg *SeekMessage) Encode0()

type SetBufferMessage

type SetBufferMessage struct {
	StreamIDMessage
	Millisecond uint32
}

SetBuffer Length (=3) The client sends this event to inform the server of the buffer size (in milliseconds) that is used to buffer any data coming over a stream. This event is sent before the server starts | processing the stream. The first 4 bytes of the event data represent the stream ID and the next | 4 bytes represent the buffer length, in milliseconds.

func (*SetBufferMessage) Encode

func (msg *SetBufferMessage) Encode() []byte

type SetPeerBandwidthMessage

type SetPeerBandwidthMessage struct {
	AcknowledgementWindowsize uint32 // 4 bytes
	LimitType                 byte
}

AcknowledgementWindowsize (4 bytes) LimitType : The Limit Type is one of the following values: 0 - Hard, 1 - Soft, 2- Dynamic.

func (*SetPeerBandwidthMessage) Encode

func (msg *SetPeerBandwidthMessage) Encode() (b []byte)

type StreamIDMessage

type StreamIDMessage struct {
	UserControlMessage
	StreamID uint32
}

Stream Begin (=0) The server sends this event to notify the client that a stream has become functional and can be used for communication. By default, this event is sent on ID 0 after the application connect command is successfully received from the client. The event data is 4-byte and represents the stream ID of the stream that became functional.

func (*StreamIDMessage) Encode

func (msg *StreamIDMessage) Encode() (b []byte)

type Uint32Message

type Uint32Message uint32

chunk size (31 bits): This field holds the new maximum chunk size,in bytes, which will be used for all of the sender’s subsequent chunks until further notice

func (Uint32Message) Encode

func (msg Uint32Message) Encode() (b []byte)

type UserControlMessage

type UserControlMessage struct {
	EventType uint16
	EventData []byte
}

Event Type (16 bits) : The first 2 bytes of the message data are used to identify the Event type. Event type is followed by Event data. Event Data

func (*UserControlMessage) Encode

func (msg *UserControlMessage) Encode() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL