您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 其它行业文档 > 视频播放器源码max讲义
VideoPlayerActivity.javapackagecom.zh_weir.videoplayer;importjava.io.File;importjava.io.FileFilter;importjava.net.MalformedURLException;importjava.net.URISyntaxException;importjava.net.URL;importjava.util.LinkedList;importorg.apache.http.client.entity.UrlEncodedFormEntity;importcom.admob.android.ads.AdView;importcom.zh_weir.videoplayer.SoundView.OnVolumeChangedListener;importcom.zh_weir.videoplayer.VideoView.MySizeChangeLinstener;importandroid.R.integer;importandroid.app.Activity;importandroid.app.AlertDialog;importandroid.app.Dialog;importandroid.content.Context;importandroid.content.DialogInterface;importandroid.content.Intent;importandroid.content.pm.ActivityInfo;importandroid.content.res.Configuration;importandroid.database.Cursor;importandroid.media.AudioManager;importandroid.media.MediaPlayer;importandroid.media.MediaPlayer.OnCompletionListener;importandroid.media.MediaPlayer.OnErrorListener;importandroid.media.MediaPlayer.OnPreparedListener;importandroid.net.Uri;importandroid.os.Bundle;importandroid.os.Handler;importandroid.os.Looper;importandroid.os.Message;importandroid.os.MessageQueue.IdleHandler;importandroid.provider.MediaStore;importandroid.text.AndroidCharacter;importandroid.util.Log;importandroid.view.Display;importandroid.view.Gravity;importandroid.view.KeyEvent;importandroid.view.MotionEvent;importandroid.view.View;importandroid.view.Window;importandroid.view.WindowManager;importandroid.view.View.OnClickListener;importandroid.view.View.OnLongClickListener;importandroid.view.ViewGroup.LayoutParams;importandroid.widget.AnalogClock;importandroid.widget.Button;importandroid.widget.ImageButton;importandroid.widget.PopupWindow;importandroid.widget.SeekBar;importandroid.widget.TextView;importandroid.widget.SeekBar.OnSeekBarChangeListener;importandroid.view.GestureDetector;importandroid.view.GestureDetector.SimpleOnGestureListener;publicclassVideoPlayerActivityextendsActivity{privatefinalstaticStringTAG=VideoPlayerActivity;privatebooleanisOnline=false;privatebooleanisChangedVideo=false;publicstaticLinkedListMovieInfoplayList=newLinkedListMovieInfo();publicclassMovieInfo{StringdisplayName;Stringpath;}privateUrivideoListUri=MediaStore.Video.Media.EXTERNAL_CONTENT_URI;privatestaticintposition;privatestaticbooleanbackFromAD=false;privateintplayedTime;privateAdViewadView;privateVideoViewvv=null;privateSeekBarseekBar=null;privateTextViewdurationTextView=null;privateTextViewplayedTextView=null;privateGestureDetectormGestureDetector=null;privateAudioManagermAudioManager=null;privateintmaxVolume=0;privateintcurrentVolume=0;privateImageButtonbn1=null;privateImageButtonbn2=null;privateImageButtonbn3=null;privateImageButtonbn4=null;privateImageButtonbn5=null;privateViewcontrolView=null;privatePopupWindowcontroler=null;privateSoundViewmSoundView=null;privatePopupWindowmSoundWindow=null;privateViewextralView=null;privatePopupWindowextralWindow=null;privatestaticintscreenWidth=0;privatestaticintscreenHeight=0;privatestaticintcontrolHeight=0;privatefinalstaticintTIME=6868;privatebooleanisControllerShow=true;privatebooleanisPaused=false;privatebooleanisFullScreen=false;privatebooleanisSilent=false;privatebooleanisSoundShow=false;/**Calledwhentheactivityisfirstcreated.*/@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.main);Log.d(OnCreate,getIntent().toString());Looper.myQueue().addIdleHandler(newIdleHandler(){publicbooleanqueueIdle(){//TODOAuto-generatedmethodstubif(controler!=null&&vv.isShown()){controler.showAtLocation(vv,Gravity.BOTTOM,0,0);//controler.update(screenWidth,controlHeight);controler.update(0,0,screenWidth,controlHeight);}if(extralWindow!=null&&vv.isShown()){extralWindow.showAtLocation(vv,Gravity.TOP,0,0);extralWindow.update(0,25,screenWidth,60);}//myHandler.sendEmptyMessageDelayed(HIDE_CONTROLER,TIME);returnfalse;}});controlView=getLayoutInflater().inflate(R.layout.controler,null);controler=newPopupWindow(controlView);durationTextView=(TextView)controlView.findViewById(R.id.duration);playedTextView=(TextView)controlView.findViewById(R.id.has_played);mSoundView=newSoundView(this);mSoundView.setOnVolumeChangeListener(newOnVolumeChangedListener(){publicvoidsetYourVolume(intindex){cancelDelayHide();updateVolume(index);hideControllerDelay();}});mSoundWindow=newPopupWindow(mSoundView);extralView=getLayoutInflater().inflate(R.layout.extral,null);extralWindow=newPopupWindow(extralView);ImageButtonbackButton=(ImageButton)extralView.findViewById(R.id.back);ImageButtonaboutButton=(ImageButton)extralView.findViewById(R.id.about);position=-1;backButton.setOnClickListener(newOnClickListener(){//@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubVideoPlayerActivity.this.finish();}});aboutButton.setOnClickListener(newOnClickListener(){Dialogdialog;OnClickListenermClickListener=newOnClickListener(){//@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubLog.d(DIALOG,DISMISS);dialog.dismiss();//vv.seekTo(msec);vv.start();}};//@
本文标题:视频播放器源码max讲义
链接地址:https://www.777doc.com/doc-4101675 .html