Skip to content

Commit

Permalink
更新文档和示例,主要是下载文件
Browse files Browse the repository at this point in the history
  • Loading branch information
vanjoge committed Aug 17, 2023
1 parent 8106887 commit 6ff6ce2
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 7 deletions.
24 changes: 24 additions & 0 deletions JsAccess.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,30 @@ CvNetVideo.GovPlay(
);
```

#### 下载历史视频文件
接口
```
DownLoadVideo(Sim, Channel, MediaType, StreamType = 0, StorageType = 0, PlaybackMode = 0, Multiple = 0, StartTime, EndTime, config = {}, DataSource = 0, Speed = 4, VideoFormat = 0) ;
```
参数说明
```
Sim:sim卡号
Channel:通道号不支持0
MediaType:音视频资源类型(0:音视频,1:音频,2:视频,3:视频或音视频)
StreamType:码流类型(0:主码流或子码流,1:主码流,2:子码流)
StorageType:存储器类型(0:主存储器或灾备存储器,1:主存储器,2:灾备存储器)
PlaybackMode:回放模式(0:正常回放,1:快进回放,2:关键帧快退回放,3:关键帧播放,4:单帧上传)
Multiple:倍速(0:无效,1:1倍,2:2倍,3:4倍,4:8倍,5:16倍)
StartTime:开始时间
EndTime:结束时间
config:配置项 与Init一致
DataSource:0自动 1设备 2服务端缓存
Speed:下载倍速,仅28181有效
VideoFormat:文件格式(0:FMP4格式,1:FLV格式)
```


#### 下载FMP4文件
接口
```
Expand Down
25 changes: 24 additions & 1 deletion Platform808Access.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,30 @@ RTVS转码MP4并上传FTP完成后,会通过TranscodeUploadStart指定的方
http://[GOV服务地址]/[SIM]_[通道]_[开始UTC时间]_[结束UTC时间].mp4?MediaType=[音视频类型]&StreamType=[码流类型]&PlaybackMode=[回放方式]&Multiple=[倍数]&DataSource=[来源]&CTags=[CTags]


例:http://10.10.10.228:6035/111111111112_1_1651745996_0?MediaType=0&StreamType=1&PlaybackMode=0&Multiple=1&DataSource=1&CTags=test
例:http://10.10.10.228:6035/111111111112_1_1651745996_0.mp4?MediaType=0&StreamType=1&PlaybackMode=0&Multiple=1&DataSource=1&CTags=test


MediaType、StreamType、PlaybackMode和Multiple数值定义见1078协议9201,DataSource为来源 0自动 1设备 2服务端缓存

### GOV服务获取FLV HTTP流(实时)

接口地址:

http://[GOV服务地址]/[SIM]_[通道]_real.flv?DataType=[数据类型]&StreamType=[码流类型]&CTags=[CTags]


例:http://10.10.10.228:6035/111111111112_1_real.flv?DataType=0&StreamType=0&CTags=test

DataType和StreamType数值定义见1078协议9101

### GOV服务获取FLV HTTP流(历史)

接口地址:

http://[GOV服务地址]/[SIM]_[通道]_[开始UTC时间]_[结束UTC时间].flv?MediaType=[音视频类型]&StreamType=[码流类型]&PlaybackMode=[回放方式]&Multiple=[倍数]&DataSource=[来源]&CTags=[CTags]


例:http://10.10.10.228:6035/111111111112_1_1651745996_0.flv?MediaType=0&StreamType=1&PlaybackMode=0&Multiple=1&DataSource=1&CTags=test


MediaType、StreamType、PlaybackMode和Multiple数值定义见1078协议9201,DataSource为来源 0自动 1设备 2服务端缓存
Expand Down
39 changes: 33 additions & 6 deletions test/tstrtvs.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ <h3>指令参数</h3>
<option value="3">音频或视频</option>
</select>
</td>
<td><button onclick="Snapshot()" disabled>获取快照</button></td>
<td><input type="checkbox" id="forceSnapshot" style="width: 20px;" />重新抓拍模式</td>
</tr>
<tr>
<td>
Expand Down Expand Up @@ -210,8 +212,9 @@ <h3>指令参数</h3>
<option value="5">16倍</option>
</select>
</td>
<td>
<button onclick="StartDownload()" disabled>开始下载</button>
<td colspan="2">
<button onclick="StartDownload(0)" disabled>开始下载(MP4)</button>
<button onclick="StartDownload(1)" disabled>开始下载(FLV)</button>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -330,6 +333,7 @@ <h3>指令参数</h3>
<option value="4">fmp4</option>
<option value="5">webrtc</option>
<option value="6">hls</option>
<option value="7">codec(需HTTPS)</option>
</select>
</td>
<td>实时视频追帧:</td>
Expand Down Expand Up @@ -364,6 +368,11 @@ <h3>指令参数</h3>
<option value="0.8">0.8</option>
<option value="0.9">0.9</option>
<option value="1.0" selected="selected">1.0</option>
<option value="1.5">1.5</option>
<option value="2.0">2.0</option>
<option value="3.0">3.0</option>
<option value="5.0">5.0</option>
<option value="10.0">10.0</option>
</select>
</td>
</tr>
Expand Down Expand Up @@ -412,7 +421,7 @@ <h3>按天回放</h3>

document.getElementById("txtDragPlaybackPosition").value = GetDateStr(now, -55 * 60);

document.getElementById("txtEndtime").value = GetDateStr(now, -50 * 60);
document.getElementById("txtEndtime").value = GetDateStr(now, -57 * 60);


};
Expand Down Expand Up @@ -708,6 +717,22 @@ <h3>按天回放</h3>
parseInt(document.querySelector('#cmbDataSource').value)
);
}
function Snapshot() {
CvNetVideo.Snapshot(
document.querySelector('#txtsim').value,
GetChannel(),
document.querySelector('#forceSnapshot').checked,
function (is_success, url, reason) {
console.log("is_success:" + is_success + " url:" + url + " reason:" + reason)
},
{
clusterHost: document.querySelector("#txtserveradd").value,
clusterPort: document.querySelector("#txtport").value,
protocol: document.querySelector("#protocol").value,
isUseCdn: document.querySelector("#isUseCdn").value === 'true'
},
);
}
function AVTransferControl(id) {
CvNetVideo.AVTransferControl(
document.querySelector('#txtsim').value,
Expand All @@ -724,9 +749,9 @@ <h3>按天回放</h3>
}
);
}
function StartDownload() {
function StartDownload(videoFormat) {

CvNetVideo.DownLoadFmp4(
CvNetVideo.DownLoadVideo(
document.querySelector('#txtsim').value,
GetChannel(),
parseInt(document.querySelector('#cmbMideaType').value),
Expand All @@ -742,7 +767,9 @@ <h3>按天回放</h3>
protocol: document.querySelector("#protocol").value,
isUseCdn: document.querySelector("#isUseCdn").value === 'true'
},
parseInt(document.querySelector('#cmbDataSource').value)
parseInt(document.querySelector('#cmbDataSource').value),
4,
videoFormat
)
}
function PlaybackVideo(id) {
Expand Down

0 comments on commit 6ff6ce2

Please sign in to comment.