diff --git a/mediastreammodel.go b/mediastreammodel.go index 5c52857..de7dc1f 100644 --- a/mediastreammodel.go +++ b/mediastreammodel.go @@ -58,21 +58,39 @@ func (e *Package) MediaRequestAliveVideo(token int, camNo int64, Sid string, ser // main server util func (e *Package) MediaRequestRemotePlayback(token int, serial string, session string, camNo int, date string, begin_time string, end_time string, serverId int) { - e.Payload = map[string]any{ - "MODULE": "MEDIASTREAMMODEL", - "OPERATION": "REQUESTREMOTEPLAYBACK", - "PARAMETER": map[string]any{ - "STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId), - "STREAMTYPE": 1, // main stream - "VIDEOTYPE": 2, // common files - "CHANNEL": 1 << (camNo - 1), - "STARTTIME": date + begin_time, - // "ENDTIME": date + end_time, - "IPANDPORT": ip + ":12092", - "SERIAL": token, - "PBST": 0, - }, - "SESSION": session, + if end_time == "" { + e.Payload = map[string]any{ + "MODULE": "MEDIASTREAMMODEL", + "OPERATION": "REQUESTREMOTEPLAYBACK", + "PARAMETER": map[string]any{ + "STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId), + "STREAMTYPE": 1, // main stream + "VIDEOTYPE": 2, // common files + "CHANNEL": 1 << (camNo - 1), + "STARTTIME": date + begin_time, + "IPANDPORT": ip + ":12092", + "SERIAL": token, + "PBST": 0, + }, + "SESSION": session, + } + } else { + e.Payload = map[string]any{ + "MODULE": "MEDIASTREAMMODEL", + "OPERATION": "REQUESTREMOTEPLAYBACK", + "PARAMETER": map[string]any{ + "STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId), + "STREAMTYPE": 1, // main stream + "VIDEOTYPE": 2, // common files + "CHANNEL": 1 << (camNo - 1), + "STARTTIME": date + begin_time, + "ENDTIME": date + end_time, + "IPANDPORT": ip + ":12092", + "SERIAL": token, + "PBST": 0, + }, + "SESSION": session, + } } }