Cocos2d-x Video Control Videoplayer user Action Bar progress bar removal

Source: Internet
Author: User

cocos目前出了新的视频播放器控件,仅支持ios和android平台,不支持window平台。项目打算使用一段视屏片头,所以使用该视频控件来播放片头。目前遇到两个问题:(1)视频控件移除有问题,会报异常。(2)视频控件有用户操作栏,用户点击屏幕会停止视频播放。对于第一个问题,主要是移除控件时冲突引起的,目前简单处理是做一个延时处理,先stop视频播放,然后一个Action移除自身,如下:
    localfunction onComplete()            video:stop()            video:runAction(                cc.Sequence:create(                    cc.CallFunc:create(callback),                    cc.RemoveSelf:create()                )            )    end 
  The second problem is cumbersome to deal with by removing the user clicks and user action bars in the control implementation. In the Android version of the video will have a click on the screen pause and resume function, this is implemented in the Java layer, directly comment out the click of the response, you can block the user's actions. 
cocos2dxvideoview.java 201  @ Override public  boolean ontouchevent  ( Motionevent event ) {if  ((event . Getaction () & motionevent.action_mask) = = motionevent.action_up) {if  (isplaying ()) {//pause ();                 } else  if  (mcurrentstate = = state_paused) {            //resume ();     }} return  true ; }
在ios版本里视频会有一个操作栏,这个oc代码里的视频控件有个样式,更改controlStyle 这个属性,即可隐藏进度条,另外修改userInteractionEnabled 属性,让视频不响应点击事件。
    UIVideoPlayer-ios.mm    self.moviePlayer.allowsAirPlay = false;    self.moviePlayer.controlStyle = MPMovieControlStyleNone;//  MPMovieControlStyleEmbedded;    self.moviePlayer.view.userInteractionEnabled = false;   //true;
除了上述问题,该视频控件目前只能遮盖在用户显示层的上层,对于某些比如嵌入播放之类操作,依然有很多问题,希望cocos能后续继续完善。

Cocos2d-x Video Control videoplayer the user Action Bar progress bar removal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.