cocos2d播放器使用

void HelloWorld::MoveVideo(){

 int xCoord = 200;
 int yCoord = 200;
 int width = 720;
 int height = 576;

 //CComModule _Module; 
 //_pAtlModule=&_Module;

 //CAxWindow  m_wndView;  // ActiveX host window class.
 //CComPtr<IWMPPlayer4>  m_spWMPPlayer;  // Smart pointer to IWMPPlayer interface.

 AtlAxWinInit();

 CComPtr<IAxWinHostWindow>  spHost;

 HRESULT  hr;

 RECT rect = {xCoord,yCoord,xCoord + width,yCoord + height};
 HWND hwndReturned = m_wndView.Create(CCDirector::sharedDirector()->getOpenGLView()->getHWnd(), rect, 0, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);

 hr = m_wndView.QueryHost(&spHost);

 if ( SUCCEEDED( hr ) )
  hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);

 if ( SUCCEEDED( hr ) )
  hr = m_wndView.QueryControl(&m_spWMPPlayer);


 m_spWMPControls = m_spWMPPlayer;
 m_spSettings = m_spWMPPlayer;

 BSTR mode = SysAllocString(L"loop");

 m_spSettings->setMode(mode,VARIANT_TRUE);
 //m_spSettings->put_autoStart(VARIANT_FALSE);
 
 m_spWMPPlayer->get_enableContextMenu(VARIANT_FALSE);
 //BSTR uiMode = SysAllocString(L"none");
 //m_spWMPPlayer->put_uiMode(uiMode);
 
 //m_spWMPPlayer->put_windowlessVideo(VARIANT_TRUE);
 BSTR bsURL = SysAllocString(L"test.avi");
 m_spWMPPlayer->put_URL(bsURL);

 //m_wndView.MoveWindow(100,100,480,320);
 //VARIANT_BOOL vbFull = VARIANT_TRUE;
 //m_spWMPPlayer->get_fullScreen(&vbFull);

 
 

 //m_spWMPPlayer->get_settings()  //拉伸适应窗口
 //m_spWMPPlayer->GetSettings().SetAutoStart(FALSE); //禁止自动播放
 //m_spWMPPlayer->GetSettings().setMode("loop",true); //循环播放
 //m_spWMPPlayer->SetUrl("list.wpl");    //播放列表
 //m_spWMPPlayer->GetControls().play();  //播放
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值