mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-16 08:41:08 +02:00
fixed vod stopping: added NetStream.Play.Complete meta message
This commit is contained in:
parent
0740b046d6
commit
fb824371e7
|
@ -501,6 +501,8 @@ ngx_int_t ngx_rtmp_receive_amf(ngx_rtmp_session_t *s, ngx_chain_t *in,
|
|||
/* AMF status sender */
|
||||
ngx_int_t ngx_rtmp_send_status(ngx_rtmp_session_t *s, char *code,
|
||||
char* level, char *desc);
|
||||
ngx_int_t ngx_rtmp_send_play_status(ngx_rtmp_session_t *s, char *code,
|
||||
char* level, ngx_uint_t duration, ngx_uint_t bytes);
|
||||
|
||||
|
||||
/* Frame types */
|
||||
|
|
|
@ -161,6 +161,7 @@ ngx_rtmp_play_send(ngx_event_t *e)
|
|||
|
||||
ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_MSID);
|
||||
|
||||
ngx_rtmp_send_play_status(s, "NetStream.Play.Complete", "status", 0, 0);
|
||||
ngx_rtmp_send_status(s, "NetStream.Play.Stop", "status", "Stopped");
|
||||
}
|
||||
|
||||
|
|
|
@ -346,3 +346,60 @@ ngx_rtmp_send_status(ngx_rtmp_session_t *s, char *code, char* level, char *desc)
|
|||
return ngx_rtmp_send_amf(s, &h, out_elts,
|
||||
sizeof(out_elts) / sizeof(out_elts[0]));
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_rtmp_send_play_status(ngx_rtmp_session_t *s, char *code, char* level,
|
||||
ngx_uint_t duration, ngx_uint_t bytes)
|
||||
{
|
||||
ngx_rtmp_header_t h;
|
||||
static double dduration;
|
||||
static double dbytes;
|
||||
|
||||
static ngx_rtmp_amf_elt_t out_inf[] = {
|
||||
|
||||
{ NGX_RTMP_AMF_STRING,
|
||||
ngx_string("code"),
|
||||
NULL, 0 },
|
||||
|
||||
{ NGX_RTMP_AMF_STRING,
|
||||
ngx_string("level"),
|
||||
NULL, 0 },
|
||||
|
||||
{ NGX_RTMP_AMF_NUMBER,
|
||||
ngx_string("duration"),
|
||||
&dduration, 0 },
|
||||
|
||||
{ NGX_RTMP_AMF_NUMBER,
|
||||
ngx_string("bytes"),
|
||||
&dbytes, 0 },
|
||||
};
|
||||
|
||||
static ngx_rtmp_amf_elt_t out_elts[] = {
|
||||
|
||||
{ NGX_RTMP_AMF_STRING,
|
||||
ngx_null_string,
|
||||
"onPlayStatus", 0 },
|
||||
|
||||
{ NGX_RTMP_AMF_OBJECT,
|
||||
ngx_null_string,
|
||||
out_inf,
|
||||
sizeof(out_inf) },
|
||||
};
|
||||
|
||||
|
||||
out_inf[0].data = code;
|
||||
out_inf[1].data = level;
|
||||
|
||||
dduration = duration;
|
||||
dbytes = bytes;
|
||||
|
||||
memset(&h, 0, sizeof(h));
|
||||
|
||||
h.type = NGX_RTMP_MSG_AMF_META;
|
||||
h.csid = NGX_RTMP_CSID_AMF;
|
||||
h.msid = NGX_RTMP_MSID;
|
||||
|
||||
return ngx_rtmp_send_amf(s, &h, out_elts,
|
||||
sizeof(out_elts) / sizeof(out_elts[0]));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue