diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index cd5d0fc8..d2a2d124 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -215,8 +215,14 @@ var RTMPProtocolStringsLower = [...]string{ "rtmfp", } +type Session interface { + Open() error + Write([]byte) (int, error) + Close() error +} + // session provides parameters required for an rtmp communication session. -type Session struct { +type session struct { rtmp *C.RTMP url string timeout uint @@ -374,7 +380,7 @@ type C_AMFObject struct { // NewSession returns a new session. func NewSession(url string, connectTimeout uint) Session { - return Session{ + return &session{ url: url, timeout: connectTimeout, } @@ -382,7 +388,7 @@ func NewSession(url string, connectTimeout uint) Session { // Open establishes an rtmp connection with the url passed into the // constructor -func (s *Session) Open() error { +func (s *session) Open() error { if s.rtmp != nil { return errors.New("rtmp: attempt to start already running session") } @@ -395,7 +401,7 @@ func (s *Session) Open() error { } // Close terminates the rtmp connection -func (s *Session) Close() error { +func (s *session) Close() error { if s.rtmp == nil { return Err(3) } @@ -408,7 +414,7 @@ func (s *Session) Close() error { } // Write writes a frame (flv tag) to the rtmp connection -func (s *Session) Write(data []byte) (int, error) { +func (s *session) Write(data []byte) (int, error) { if s.rtmp == nil { return 0, Err(3) }