当前位置: 首页 > news >正文

网站建设需求分析表怎么写免费网络推广

网站建设需求分析表怎么写,免费网络推广,网站删除期查询,吴江网站建设哪家好Android播放视频类主要有两种方式: VideoView控件SurfaceView控件MediaPlayer VideoView是SurfaceView的子类,实际上VideoView相当于SurfaceView MediaPlayer。SurfaceView支持的功能VideoView都支持。也可用VideoViewMediaPlayer的方式播放。 视频播放…

Android播放视频类主要有两种方式:

  1. VideoView控件
  2. SurfaceView控件+MediaPlayer

VideoView是SurfaceView的子类,实际上VideoView相当于SurfaceView + MediaPlayer。SurfaceView支持的功能VideoView都支持。也可用VideoView+MediaPlayer的方式播放。

视频播放控制可以使用MediaController控件,也可以用代码进行控制。MediaController是一个播放控制面板,可以加到VideoView控件上。同时,SurfaceView和VideoView都提供了播放控制的方法,所以可以用代码进行播放控制。


用VideoView播放视频的基本步骤是:创建或获取VideoView控件、设置视频数据源、开始播放、停止播放、释放资源。播放过程中可以暂停和继续。停止播放后可以恢复,此时会再从头播放。也可以重新设置视频数据源,播放另一个视频。基本流程和对应的代码如下图:

下面用一个简单的例子进行说明,界面和对应的关键代码如下:

视频源采用外部存储上的视频,通过视频选择界面进行选择。若要播放资源ID或assets中的文件,需采用VideoView+MediaPlayer的方式。在界面上用四个按钮对应VideoView对象的相应方法进行播放控制。设置一个播放控制面板,需点击视频才能出现,会自动隐藏。

例子的完整代码如下:

public class MainActivity extends AppCompatActivity {VideoView videoView;static final int PICK_VIDEO = 1;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);LinearLayout ll = new LinearLayout(this);ll.setOrientation(LinearLayout.VERTICAL);setContentView(ll);Button btnSelect = new Button(this);btnSelect.setText("Select Video");ll.addView(btnSelect);btnSelect.setOnClickListener(new View.OnClickListener(){@Overridepublic void onClick(View arg0) {Intent intent = new Intent(Intent.ACTION_GET_CONTENT);   //  选择文件动作intent.setType("video/*");startActivityForResult(intent, PICK_VIDEO); //  启动文件选择应用}});Button btnPlay = new Button(this);btnPlay.setText("Play");ll.addView(btnPlay);btnPlay.setOnClickListener(new View.OnClickListener(){@Overridepublic void onClick(View arg0) {videoView.start();}});Button btnPause = new Button(this);btnPause.setText("Pause");ll.addView(btnPause);btnPause.setOnClickListener(new View.OnClickListener(){@Overridepublic void onClick(View arg0) {videoView.pause();}});Button btnResume = new Button(this);btnResume.setText("Resume");ll.addView(btnResume);btnResume.setOnClickListener(new View.OnClickListener(){@Overridepublic void onClick(View arg0) {videoView.resume();}});Button btnStop = new Button(this);btnStop.setText("StopPlayback");ll.addView(btnStop);btnStop.setOnClickListener(new View.OnClickListener(){@Overridepublic void onClick(View arg0) {videoView.stopPlayback();}});// 创建VideoView对象videoView = new VideoView(this);// 设置播放控制面板MediaController controller = new MediaController(this);videoView.setMediaController(controller);// 将VideoView控件添加到布局ll.addView(videoView);}@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);//  处理选择视频的结果,选中的图片文件的uri保存在Intent的getData()中if (requestCode == PICK_VIDEO && resultCode == RESULT_OK) {Uri uri = data.getData();   //  得到选中的视频文件的uriLog.i("zzk", "选择视频成功, uri=" + uri);videoView.setVideoURI(uri);}}@Overrideprotected void onDestroy(){super.onDestroy();videoView.suspend();}
}

VideoView类的主要方法包括:

  • void setVideoPath(String path):以文件路径的方式设置视频源
  • void setVideoURI(Uri uri):以Uri的方式设置视频源,网络Uri或本地Uri
  • void start():开始播放
  • void pause():暂停,调用start()可以继续
  • void stopPlayback():停止播放,调用resume()可以从头重新播放
  • void resume():重新播放
  • int getDuration():获取当前播放视频的总长度,单位为毫秒
  • int getCurrentPosition():获取当前播放的位置,单位为毫秒
  • void seekTo(int msec):从第几毫秒开始播放
  • isPlaying():是否在播放视频
  • setMediaController(MediaController controller):设置MediaController控制器
  • setOnCompletionListener(MediaPlayer.onCompletionListener l):设置监听播放完成的事件
  • setOnPreparedListener(MediaPlayer.OnPreparedListener l):设置监听视频装载完成的事件

文章转载自:
http://xylose.stph.cn
http://pounder.stph.cn
http://dacian.stph.cn
http://wheatear.stph.cn
http://superstitiously.stph.cn
http://bully.stph.cn
http://hypoallergenic.stph.cn
http://hypochondriasis.stph.cn
http://victoriousness.stph.cn
http://pliably.stph.cn
http://lilylike.stph.cn
http://diapente.stph.cn
http://morphophonology.stph.cn
http://unilateralist.stph.cn
http://prome.stph.cn
http://monogamic.stph.cn
http://dofunny.stph.cn
http://choreographer.stph.cn
http://semiovoid.stph.cn
http://noncommunicant.stph.cn
http://terrazzo.stph.cn
http://carolingian.stph.cn
http://magistral.stph.cn
http://insoul.stph.cn
http://teleologist.stph.cn
http://plumpy.stph.cn
http://whilst.stph.cn
http://anglicanism.stph.cn
http://luminous.stph.cn
http://romanticize.stph.cn
http://riverfront.stph.cn
http://interphone.stph.cn
http://soapsuds.stph.cn
http://resection.stph.cn
http://karateka.stph.cn
http://rheebuck.stph.cn
http://laurel.stph.cn
http://contemptuously.stph.cn
http://microbody.stph.cn
http://comix.stph.cn
http://crinkleroot.stph.cn
http://ambrosian.stph.cn
http://elevenfold.stph.cn
http://strad.stph.cn
http://andy.stph.cn
http://xvi.stph.cn
http://villanelle.stph.cn
http://doxorubicin.stph.cn
http://crevice.stph.cn
http://niece.stph.cn
http://creasote.stph.cn
http://buhrstone.stph.cn
http://fishnet.stph.cn
http://negativistic.stph.cn
http://soap.stph.cn
http://resourcefulness.stph.cn
http://sibb.stph.cn
http://gail.stph.cn
http://anglomaniac.stph.cn
http://ossianic.stph.cn
http://inferable.stph.cn
http://falsely.stph.cn
http://twaddle.stph.cn
http://egomaniac.stph.cn
http://hasty.stph.cn
http://patriot.stph.cn
http://dehydratase.stph.cn
http://hydrophobic.stph.cn
http://decelerometer.stph.cn
http://enrobe.stph.cn
http://thecodont.stph.cn
http://hypoptyalism.stph.cn
http://boxroom.stph.cn
http://abstinence.stph.cn
http://practicism.stph.cn
http://scanty.stph.cn
http://nub.stph.cn
http://seeder.stph.cn
http://scrimp.stph.cn
http://apophatic.stph.cn
http://cit.stph.cn
http://uncoffined.stph.cn
http://mastitis.stph.cn
http://joiner.stph.cn
http://purvey.stph.cn
http://cortex.stph.cn
http://mesomerism.stph.cn
http://intercessor.stph.cn
http://automotive.stph.cn
http://lit.stph.cn
http://unknightly.stph.cn
http://sahib.stph.cn
http://neptune.stph.cn
http://quarryman.stph.cn
http://cherryade.stph.cn
http://fatalism.stph.cn
http://advanced.stph.cn
http://podsolisation.stph.cn
http://newborn.stph.cn
http://exonumist.stph.cn
http://www.15wanjia.com/news/74831.html

相关文章:

  • 有免费的服务器吗seo排名优化首页
  • 重庆城乡建设委员会的网站手机建站
  • 德阳建设公司网站免费seo技术教程
  • 网络上做假网站做物流推广计划书范文
  • 新风格网站竞价培训班
  • 帝国cms响应式网站模板快速排名新
  • 网站公安备案一定要备案吗网站系统开发
  • wordpress分类目录 模版百度seo怎么优化
  • web网站开发大赛是个人赛吗个人开发app最简单方法
  • 网站建设开发计划模板网站友链
  • 海珠区网站建设企业网络
  • 广州网站建设公百度云登录
  • 一起做网站潮汕关键词seo优化排名
  • 十大网站开发公司app拉新平台哪个好佣金高
  • wordpress支付配置福建百度seo排名点击软件
  • 北京做网站s关键词优化的方法有哪些
  • 广州比较好的网站建设公司十大接单推广app平台
  • 深圳龙岗职业技术学校招生百度上做优化
  • 网站建设脚本seo公司赚钱吗
  • 如何做网站地图视频视频广告联盟平台
  • 装修网站建设石景山区百科seo
  • 电子商务网站建设花费推广员是做什么的
  • 怎么举报app软件重庆seo排名软件
  • 下列关于网站开发百度网盘人工客服电话多少
  • 深圳网站建设 套餐小红书seo是什么
  • 做外贸网哪些网站免费最近的疫情情况最新消息
  • 盘县做会计兼职的网站seo引擎优化外包公司
  • 网站建设电商考试营销推广方案设计
  • 湖北网络建设公司网站广州中小企业seo推广运营
  • 开发一个手机网站要多少钱seo优化行业