代碼說明:
1.注意關於這兩個函數API的說明:
Hik_PlayM4_Fast:快速播放,每次調用將使 當前播放速度加快一倍,最多調用4次;要恢復正常播放調用Hik_PlayM4_Play(),從當前位置開始正常播放。
Hik_PlayM4_Slow:慢速播放,每次調用將使當前播放速度慢一倍;最多調用4次;要恢復正常播放調用Hik_PlayM4_Play。
1.3 開始/末尾
VC++ Code:
///////////////////////////////////////////////////////////////////////////////
//Funtion:Locate to the file head.
//////////////////////////////////////////////////////////////////////////////
void CPlayerDlg::OnGotoStart()
{
// TODO: Add your control notification handler code here
if(m_bFileRefCreated)
Hik_PlayM4_SetCurrentFrameNum(PORT,0);
else
Hik_PlayM4_SetPlayPos(PORT,0);
}
///////////////////////////////////////////////////////////////////////////////
//Funtion:Locate to the end.
//////////////////////////////////////////////////////////////////////////////
void CPlayerDlg::OnGotoEnd()
{
// TODO: Add your control notification handler code here
if(m_bFileRefCreated)
{
//Note: May create many WM_FILE_END message. The best way is to synchronize the option;
int nEndFrame=m_nTotalFrames;
while(!Hik_PlayM4_SetCurrentFrameNum(PORT,nEndFrame--))
{
//TRACE("FrameNum is :%d\n",nEndFrame);
if(nEndFrame==0)
break;
}
}
else
Hik_PlayM4_SetPlayPos(PORT,1);
}
C# Code:
/// <summary>
/// 開始位置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnGotoStart_Click(object sender, EventArgs e)
{
HikPlayer.Hik_PlayM4_SetPlayPos(PORT, 0);
}
/// <summary>
/// 末尾位置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnGotoEnd_Click(object sender, EventArgs e)
{
HikPlayer.Hik_PlayM4_SetPlayPos(PORT, 1);
}
1代碼說明:
1.注意Hik_PlayM4_SetPlayPos的第二個參數取值范圍是0-1之間,即可以理解0是開始位置,1是結束位置;但是有一點比較奇怪,每次都會 延遲3秒,即到末尾後還播放3秒鐘!