// PlayState
// ==============================================================================================================================================
// Value State Description
// 0 Undefined Windows Media Player is in an undefined state.
// 1 Stopped Playback of the current media clip is stopped.
// 2 Paused Playback of the current media clip is paused. When media is paused, resuming playback begins from the same location.
// 3 Playing The current media clip is playing.
// 4 ScanForward The current media clip is fast forwarding.
// 5 ScanReverse The current media clip is fast rewinding.
// 6 Buffering The current media clip is getting additional data from the server.
// 7 Waiting Connection is established, however the server is not sending bits. Waiting for session to begin.
// 8 MediaEnded Media has completed playback and is at its end.
// 9 Transitioning Preparing new media.
// 10 Ready Ready to begin playing.
// 11 Reconnecting Reconnecting to stream.
// ==============================================================================================================================================
来自window media sdk,但是我的实践中数值好像不对,0的状态好像没有,其他状态数值减一!
也就是Stopped状态其实是0,Paused状态是1 ... 以此类推
1.long total = (long)m_player.GetDuration();
CString time = GetStringTime(total);
CString CProgramer_EditView::GetStringTime(long sec)
{
int h = 0;
int m = 0;
int s = 0;
if(sec >= 3600)
{
h = sec / 3600;
m = (sec - 3600*h)/60;
s = (sec - 3600*h - 60*m);
}else
{
m = sec/60;
s = sec - 60*m;
}
CString str;
str.Format("%d:%d:%d",h,m,s);
return str;
}
2.TRY{
if(leftvoice == LEFT_SD)
m_vidoHold.m_media.SetBalance(LEFT_SD);
else if(leftvoice == RIGHT_SD)
m_vidoHold.m_media.SetBalance(RIGHT_SD);
else
m_vidoHold.m_media.SetBalance(ALL_SD);
m_vidoHold.m_media.Play();
}
CATCH (COleDispatchException ,e)
{
// AfxMessageBox("格式不对!或不支持此文件");
}
END_CATCH
3.
void CVidoHold::OnPlayStateChangeMediaPlayer(long OldState, long NewState)
{
TRACE("OnPlayStateChangeMediaPlayer\n");
// TODO: Add your control notification handler code here
}
void CVidoHold::OnWarningMediaPlayer(long WarningType, long Param, LPCTSTR Description)
{
TRACE("OnWarningMediaPlayer\n");
}
void CVidoHold::OnEndOfStreamMediaPlayer(long Result)
{
g_play_state = IDLE;
// SetEvent(g_hHandleEvntPlay[PLAYOVER]);
TRACE("OnEndOfStreamMediaPlayer\n");
}
void CVidoHold::OnPlayStateChangeMediaPlayer(long OldState, long NewState)
{
TRACE("OnPlayStateChangeMediaPlayer\n");
// TODO: Add your control notification handler code here