stream.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. import request from '@/service/request'
  2. export const getStreams = () => {
  3. return request<RTS.STREAM.List[]>({
  4. url: '/api/streams',
  5. method: 'GET'
  6. })
  7. }
  8. export const getStreamsDetail = (streamPath: string) => {
  9. return request<RTS.STREAM.Detail[]>({
  10. url: `/api/stream?streamPath=${streamPath}`,
  11. method: 'GET'
  12. })
  13. }
  14. export const getSnap = (streamPath: string) => {
  15. return request<RTS.STREAM.Detail[]>({
  16. url: `/snap/${streamPath}`,
  17. method: 'GET'
  18. })
  19. }
  20. export const closeStream = (streamPath: string) => {
  21. return request<RTS.STREAM.Detail[]>({
  22. url: `/api/closestream?streamPath=${streamPath}`,
  23. method: 'GET'
  24. })
  25. }
  26. export const getPullList = () => {
  27. return request<RTS.PullStream.Detail[]>({
  28. url: '/api/list/pull',
  29. method: 'GET'
  30. })
  31. }
  32. export const stopPull = (url: string) => {
  33. return request<RTS.STREAM.Detail[]>({
  34. url: `/api/stoppull?url=${url}`,
  35. method: 'GET'
  36. })
  37. }
  38. export const createRtspPull = (params: {streamPath: string, target: string, save: number}) => {
  39. return request<RTS.STREAM.Detail[]>({
  40. url: '/rtsp/api/pull',
  41. method: 'GET',
  42. params
  43. })
  44. }
  45. export const createRtmpPull = (params: {streamPath: string, target: string, save: number}) => {
  46. return request<RTS.STREAM.Detail[]>({
  47. url: '/rtmp/api/pull',
  48. method: 'GET',
  49. params
  50. })
  51. }
  52. export const getPushList = () => {
  53. return request<RTS.PullStream.Detail[]>({
  54. url: '/api/list/push',
  55. method: 'GET'
  56. })
  57. }
  58. export const stopPush = (url: string) => {
  59. return request<RTS.STREAM.Detail[]>({
  60. url: `/api/stoppush?url=${url}`,
  61. method: 'GET'
  62. })
  63. }
  64. export const createRtspPush = (params: {streamPath: string, target: string, save: number}) => {
  65. return request<RTS.PullStream.Detail[]>({
  66. url: '/rtsp/api/push',
  67. method: 'GET',
  68. params
  69. })
  70. }
  71. export const createRtmpPush = (params: {streamPath: string, target: string, save: number}) => {
  72. return request<RTS.STREAM.Detail[]>({
  73. url: '/rtsp/api/push',
  74. method: 'GET',
  75. params
  76. })
  77. }
  78. /** 查看存储列表 */
  79. export const getRecordList = (type: 'mp4' | 'ts' | 'flv') => {
  80. return request<RTS.STREAM.Detail[]>({
  81. url: `/record/api/list?type=${type}`,
  82. method: 'GET'
  83. })
  84. }
  85. /** 正在存储的视频流 */
  86. export const getRecording = () => {
  87. return request<RTS.STREAM.Detail[]>({
  88. url: '/record/api/list/recording',
  89. method: 'GET'
  90. })
  91. }
  92. /** 开始存储 */
  93. export const postRecord = (params: {type: 'mp4' | 'ts' | 'flv', streamPath: string }) => {
  94. return request<RTS.STREAM.Detail[]>({
  95. url: '/record/api/start',
  96. method: 'GET',
  97. params
  98. })
  99. }
  100. /** 停止录制 */
  101. export const stopRecord = (id: string) => {
  102. return request<RTS.STREAM.Detail[]>({
  103. url: `/record/api/stop?id=${id}`,
  104. method: 'GET'
  105. })
  106. }
  107. /** 录制播放 */
  108. // url: `/record/${id}.${format}`,
  109. export const playRecord = (id: string, format: 'flv'| 'mp4' | 'm3u8' | 'h264'| 'h265') => {
  110. return request<RTS.STREAM.Detail[]>({
  111. url: `/record/${id}`,
  112. method: 'GET'
  113. })
  114. }
  115. /** 获取配置 RTSP */
  116. export const getConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181') => {
  117. return request<any>({
  118. url: `/api/getconfig?name=${name}`,
  119. method: 'GET'
  120. })
  121. }
  122. /** 保存配置 RTSP */
  123. export const postConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181', data: string) => {
  124. return request<any>({
  125. url: `/api/modifyconfig?name=${name}`,
  126. method: 'POST',
  127. data
  128. })
  129. }
  130. export const updateConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181') => {
  131. return request<string>({
  132. url: `/api/updateconfig?name=${name}`,
  133. method: 'GET'
  134. })
  135. }
  136. /** 系统监控 */
  137. export const getSummary = () => {
  138. return request<RTS.SUMMARY.Detail>({
  139. url: '/api/summary',
  140. method: 'GET'
  141. })
  142. }
  143. /** 系统监控 流 */
  144. export const getMonitorStream = (params: {time: string, streamPath: string}) => {
  145. return request<RTS.STREAM.Detail[]>({
  146. url: '/monitor/api/list/stream',
  147. method: 'GET',
  148. params
  149. })
  150. }
  151. /** 系统监控 轨道 */
  152. export const getMonitorTrack = (params: {time: string, streamPath: string}) => {
  153. return request<RTS.STREAM.Detail[]>({
  154. url: '/monitor/api/list/track?streamPath=xxxx',
  155. method: 'GET',
  156. params
  157. })
  158. }