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

村级门户网站建设建设银行网站进不去

村级门户网站建设,建设银行网站进不去,做医药商城网站的公司吗,国家二十条优化措施代码已经托管到码云#xff0c;有兴趣的小伙伴可以下载看看https://git.oschina.net/joy_yuan/MobilePlayer一、设置视频缓冲进度显示视频播放进度的效果图如下#xff1a;灰色的是缓冲的进度。原理#xff1a;只有播放网络视频时#xff0c;才有缓冲这个说法#xff0c;所… 代码已经托管到码云有兴趣的小伙伴可以下载看看https://git.oschina.net/joy_yuan/MobilePlayer一、设置视频缓冲进度显示视频播放进度的效果图如下灰色的是缓冲的进度。原理只有播放网络视频时才有缓冲这个说法所以要先判断视频资源是否为网络资源/*** 判断是否是网络的资源* param uri* return*/ public boolean isNetUri(String uri) {boolean reault  false;if (uri ! null) {if (uri.toLowerCase().startsWith(http) || uri.toLowerCase().startsWith(rtsp) || uri.toLowerCase().startsWith(mms)) {reault  true;}}return reault; }因此在前面不管是单个的URI还是通过list传来的mediaitem数组都要根据地址来去判断然后在handler里去设置进度条。    进度条很简单只需要设置seekbarVideo.setSecondaryProgress(int progress);即可达到设置进度。那么这个缓冲值怎么获取的呢这个是一个统一的写法没有什么原因如下代码    //网络资源缓冲 if (isNetUri){//只有网络资源有缓冲int bufferPercentage  videoview.getBufferPercentage();  //0~100int totalbuffer  bufferPercentage * seekbarVideo.getMax();int secordProgresstotalbuffer/100;seekbarVideo.setSecondaryProgress(secordProgress); }else{//本地进度条没有缓冲即第二条进度条为灰色seekbarVideo.setSecondaryProgress(0); }二、使播放本地视频时可以跳出来选择自定义播放器的方法。当我们手机里装了多个播放器后如果要播放本地视频系统会跳出来一个选择框让用户选择播放哪个视频这里用到里隐式意图只要给SystemVideoPlayer这个activity在AndroidManifext.xml里配置隐式意图即可activityandroid:name.activity.SystemVideoPlayerandroid:configChangeskeyboardHidden|screenSize|orientationandroid:screenOrientationlandscapeintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemertsp //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /data android:mimeTypevideo/* /data android:mimeTypeapplication/sdp //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemehttp /data android:mimeTypevideo/mp4 /data android:mimeTypevideo/3gp /data android:mimeTypevideo/3gpp /data android:mimeTypevideo/3gpp2 //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.LAUNCHER /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /dataandroid:mimeTypevideo/*android:schemehttp /dataandroid:mimeTypevideo/*android:schemertsp /dataandroid:mimeTypevideo/*android:schemertmp /dataandroid:mimeTypevideo/*android:schemeudp /dataandroid:mimeTypevideo/*android:schemetcp /dataandroid:mimeTypevideo/*android:schemefile /dataandroid:mimeTypevideo/*android:schemecontent /dataandroid:mimeTypevideo/*android:schememms /data android:mimeTypeapplication/octet-stream /data android:mimeTypeapplication/x-mpegurl /data android:mimeTypeapplication/vnd.apple.mpegurl //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /data android:schemecontent //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /dataandroid:mimeTypeapplication/x-mpegurlandroid:schemehttp //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemertsp /data android:schemertmp /data android:schememms /data android:schemetcp /data android:schemeudp //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /action android:nameandroid.intent.action.SEND /action android:nameandroid.intent.action.SENDTO /category android:nameandroid.intent.category.DEFAULT /data android:mimeTypevideo/* /data android:mimeTypeapplication/sdp /data android:mimeTypeapplication/octet-stream //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemehttp /data android:mimeTypevideo/* //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemefile /data android:schemecontent /data android:schemehttp /data android:schemehttps /data android:schemeftp /data android:schemertsp /data android:schemertmp /data android:schememms /data android:schemetcp /data android:schemeudp /data android:schemegopher /data android:mimeTypevideo/* /!-- data android:mimeTypeaudio/* / --/intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemefile /data android:schemecontent /data android:schemehttp /data android:schemehttps /data android:schemeftp /data android:schemertsp /data android:schemertmp /data android:schememms /data android:schemetcp /data android:schemeudp /data android:schemegopher /data android:host* /data android:pathPattern.*\\.avi /data android:pathPattern.*\\.asf /data android:pathPattern.*\\.f4v /data android:pathPattern.*\\.flv /data android:pathPattern.*\\.mkv /data android:pathPattern.*\\.mpeg /data android:pathPattern.*\\.mpg /data android:pathPattern.*\\.mov /data android:pathPattern.*\\.rm /data android:pathPattern.*\\.vob /data android:pathPattern.*\\.wmv /data android:pathPattern.*\\.ts /data android:pathPattern.*\\.tp /data android:pathPattern.*\\.m3u /data android:pathPattern.*\\.m3u8 /data android:pathPattern.*\\.m4v /data android:pathPattern.*\\.mp4 //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemertsp /data android:mimeTypevideo/* //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemertsp //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /category android:nameandroid.intent.category.BROWSABLE /data android:schemehttp /data android:mimeTypevideo/* //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /data android:mimeTypevideo/* //intent-filterintent-filteraction android:nameandroid.intent.action.VIEW /category android:nameandroid.intent.category.DEFAULT /data android:schemefile /data android:mimeTypevideo/* //intent-filterintent-filteraction android:nameandroid.intent.action.SEARCH /category android:nameandroid.intent.category.DEFAULT //intent-filter/activity三、监听视频播放卡顿时弹出一个progressbar并提示用户当前网速    在这里就要写一个布局与视频播放布局在同一个布局同样是include进来    在system_video_player.xml里加入include layoutlayout/buffering android:idid/buffering/    3.1 buffering.xml    ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:orientationhorizontalandroid:gravitycenterandroid:visibilitygoneandroid:padding3dpandroid:layout_centerInParenttrueandroid:background#33000000ProgressBarandroid:layout_width30dpandroid:layout_height30dp/TextViewandroid:gravitycenterandroid:idid/tv_netspeedandroid:text缓冲中...30kb/sandroid:layout_widthwrap_contentandroid:layout_heightwrap_content//LinearLayout    3.2 视频卡顿时在Android4.2.2后系统集成进到了videoview里了作为一个监听那么我们只要实现了这个监听就可以在里面获取卡顿时与不卡顿时的回调方法    //监听网络播放卡顿现象 if (Build.VERSION.SDK_INT  Build.VERSION_CODES.JELLY_BEAN_MR1) {videoview.setOnInfoListener(new MyOnInfoListener()); }/*** 视频播放卡顿时的监听Android4.2.2后封装到了videoview里了已经*/ public class MyOnInfoListener implements MediaPlayer.OnInfoListener{Overridepublic boolean onInfo(MediaPlayer mp, int what, int extra) {switch (what){case MediaPlayer.MEDIA_INFO_BUFFERING_START: //开始卡顿//显示卡顿的布局buffering.setVisibility(View.VISIBLE);break;case MediaPlayer.MEDIA_INFO_BUFFERING_END:  //结束卡顿buffering.setVisibility(View.GONE);break;}return true;} }这时候只要是卡顿了那么就会弹出一个progressbar在视频中央  3.3 在上面的这个是系统集成好的判断是否卡顿的方法那么我们也可以自定义判断视频是否卡顿    原理是在handler每一秒循环的消息体中去判断当前视频进度和上一次循环消息时的视频进度相减如果进度小鱼500ms那么就判断是卡顿了否则就不卡。    if (videoview.isPlaying()){int buffercurrentPosition-preCurrentPosition;if (buffer500){//视频卡了buffering.setVisibility(View.VISIBLE);}else{buffering.setVisibility(View.GONE);}}else{buffering.setVisibility(View.GONE); }preCurrentPositioncurrentPosition;    上面的代码也能判断视频卡顿时显示progressbar。四、视频播放前的loading布局与获取系统的网速    原理写一个布局与视频播放页面system_video_player.xml在一个布局里宽高都是match_parent即覆盖整个屏幕。这样当点击播放视频时会先显示这个布局然后我们再在视频准备好播放时让这个布局消失即可达到效果    4.1 system_video_player.xml?xml version1.0 encodingutf-8? RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:orientationverticalandroid:gravitycenterandroid:background#000000android:layout_widthmatch_parentandroid:layout_heightmatch_parentcom.yuanlp.mobileplayer.view.MyVideoViewandroid:layout_centerInParenttrueandroid:idid/videoviewandroid:layout_widthmatch_parentandroid:layout_heightmatch_parent/!-- loading 视频卡播放页面的各种控制按钮页面布局--include layoutlayout/media_controller android:idid/media_controller/!-- loading 视频卡顿时的页面布局--include layoutlayout/buffering android:idid/buffering/ !-- loading 页面布局--include layoutlayout/ll_loading android:idid/ll_loading/ /RelativeLayout4.2 在systemVideoPlayer.java里    public void onPrepared(MediaPlayer mp) {videoview.start(); //开始播放duration  videoview.getDuration();  //获取视频总时长seekbarVideo.setMax(duration);   //设置播放进度的最大值//发送消息来更新视频进度handler.sendEmptyMessage(PROGRESS);//设置显示的视频总时长tvDuration.setText(utils.stringForTime(duration));//默认进入播放时隐藏media_controller.setVisibility(View.GONE);isShowfalse;  //设置为隐藏//获取播放器播放视频的宽度和高度videoHeightmp.getVideoHeight();videoWidthmp.getVideoWidth();// videoview.setVideoSize(mp.getVideoWidth(),mp.getVideoHeight());setVideoType(DEFAULTSCREEN);//当准备好播放时把loading页面消失掉ll_loading.setVisibility(View.GONE);}4.2 获取网速    原理是每次handler2秒循环一次获取网速消息在2秒内获取的数据量/时间即可得到网速。具体代码如下/*** 得到网络速度* 每隔两秒调用一次* param context* return*/ public String getNetSpeed(Context context) {String netSpeed  0 kb/s;long nowTotalRxBytes  TrafficStats.getUidRxBytes(context.getApplicationInfo().uid)TrafficStats.UNSUPPORTED ? 0 :(TrafficStats.getTotalRxBytes()/1024);//转为KB;long nowTimeStamp  System.currentTimeMillis();long speed  ((nowTotalRxBytes - lastTotalRxBytes) * 1000 / (nowTimeStamp - lastTimeStamp));//毫秒转换lastTimeStamp  nowTimeStamp;lastTotalRxBytes  nowTotalRxBytes;netSpeed   String.valueOf(speed)   kb/s;Log.d(TAG, 当前总的数据nowTotalRxBytes);return  netSpeed; }这里要在loading布局声明好时就立刻发消息去handler处理来获取网速以便loading界面也出现网速显示。     //加载布局时的布局与网速显示 ll_loading (LinearLayout) findViewById(R.id.ll_loading); tv_loading_netspeed (TextView) findViewById(R.id.tv_loading_netspeed);handler.sendEmptyMessage(SPEED);  //控件只要一声明好就发消息去获取网速发完声明后就在handler里去处理消息获取网速然后在loading和卡顿时显示网速不卡顿时隐藏对应的布局    public Handler handlernew Handler(){Overridepublic void handleMessage(Message msg) {super.handleMessage(msg);switch (msg.what){case SPEED:  //显示当前网速//得到网速String netSpeed  utils.getNetSpeed(SystemVideoPlayer.this);System.out.println(当前网速netSpeed);//显示网速tv_loading_netspeed.setText(玩命加载中netSpeed);  //loading时的速度显示tv_netspeed.setText(缓冲中netSpeed);  //缓冲时的速度显示removeMessages(SPEED);handler.sendEmptyMessageDelayed(SPEED,2000);  //一定要隔2秒才能去获取网速break;}} 转载于:https://blog.51cto.com/cm0425/1950630
http://www.zqtcl.cn/news/586211/

相关文章:

  • 档案网站的建设wordpress英文主题 汉化
  • 网站建设礼品南充网站建设工作室
  • 电子商务网站建设概念wordpress 扫码支付宝
  • 上海做网站谁好营销型网站框架图
  • 太仓企业网站建设价格wordpress自动同步插件
  • 微信网站是什么淄博周村网站建设哪家好
  • 廊坊网站建设价格网站建设维护的方案
  • 站长工具综合权重查询怎样做招聘网站
  • 广东新闻联播2020sem对seo的影响有哪些
  • 女装东莞网站建设在线设计签名免费网站
  • 在国外做黄皮网站违法么网站建设北京个人
  • 深圳南头高端网站建设安卓优化大师老版本
  • 宁海做网站wordpress邀请码注册功能
  • 重庆建设网站哪家好长沙待遇好的十大国企
  • 甘肃省建设厅查询网站黄骅港信息贴吧
  • 如何做网站的逻辑结构图如何快速做一个网站
  • 郑州虚拟货币网站开发千万不能 网站
  • 石家庄做网站汉狮网络企业标准网上备案网站
  • php网站开发权限管理广州白云区网站开发
  • 北京网站开发建设 58同城wordpress 无标题
  • 黑龙seo网站优化建设网站要学编程吗
  • 花都区水务建设管理中心官方网站怎么样才能搜索到自己做的网站
  • dedecms景区网站模板wordpress显示手动摘要
  • 备案网站免网上海网站建设机构
  • 模板建网站哪个品牌好网站制作排名
  • 网站开发咨询企业排名查询
  • 东莞做网站注意事项坪山网站建设方案
  • 网站文章页图片不显示图片手机设计
  • 公司网站版面怎么设计湖南做网站 就问磐石网络专业
  • 描述网站开发的广告词黄页网络的推广