正在显示
1 个修改的文件
包含
31 行增加
和
0 行删除
@@ -308,6 +308,36 @@ class RESTDvrs(object): | @@ -308,6 +308,36 @@ class RESTDvrs(object): | ||
308 | 308 | ||
309 | return code | 309 | return code |
310 | 310 | ||
311 | + | ||
312 | +''' | ||
313 | +handle the hls proxy requests: hls stream. | ||
314 | +''' | ||
315 | +class RESTProxy(object): | ||
316 | + exposed = True | ||
317 | + | ||
318 | + ''' | ||
319 | + for SRS hook: on_hls_notify | ||
320 | + on_hls_notify: | ||
321 | + when srs reap a ts file of hls, call this hook, | ||
322 | + used to push file to cdn network, by get the ts file from cdn network. | ||
323 | + so we use HTTP GET and use the variable following: | ||
324 | + [app], replace with the app. | ||
325 | + [stream], replace with the stream. | ||
326 | + [ts_url], replace with the ts url. | ||
327 | + ignore any return data of server. | ||
328 | + ''' | ||
329 | + def GET(self, *args, **kwargs): | ||
330 | + enable_crossdomain() | ||
331 | + | ||
332 | + hls = { | ||
333 | + "args": args, | ||
334 | + "kwargs": kwargs | ||
335 | + } | ||
336 | + | ||
337 | + ret = json.dumps(hls) | ||
338 | + print ret | ||
339 | + return ret | ||
340 | + | ||
311 | ''' | 341 | ''' |
312 | handle the hls requests: hls stream. | 342 | handle the hls requests: hls stream. |
313 | ''' | 343 | ''' |
@@ -1195,6 +1225,7 @@ class V1(object): | @@ -1195,6 +1225,7 @@ class V1(object): | ||
1195 | self.sessions = RESTSessions() | 1225 | self.sessions = RESTSessions() |
1196 | self.dvrs = RESTDvrs() | 1226 | self.dvrs = RESTDvrs() |
1197 | self.hls = RESTHls() | 1227 | self.hls = RESTHls() |
1228 | + self.proxy = RESTProxy() | ||
1198 | self.chats = RESTChats() | 1229 | self.chats = RESTChats() |
1199 | self.servers = RESTServers() | 1230 | self.servers = RESTServers() |
1200 | self.nodes = RESTNodes() | 1231 | self.nodes = RESTNodes() |
-
请 注册 或 登录 后发表评论