package com.zh_weir.videoplayer;
import java.io.File;
import java.io.FileFilter;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.LinkedList;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import com.admob.android.ads.AdView;
import com.zh_weir.videoplayer.SoundView.OnVolumeChangedListener;
import com.zh_weir.videoplayer.VideoView.MySizeChangeLinstener;
import android.R.integer;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue.IdleHandler;
import android.provider.MediaStore;
import android.text.AndroidCharacter;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AnalogClock;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.PopupWindow;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
public class VideoPlayerActivity extends Activity {
private final static String TAG = "VideoPlayerActivity";
private boolean isOnline = false;
private boolean isChangedVideo = false;
public static LinkedList<MovieInfo> playList = new LinkedList<MovieInfo>();
public class MovieInfo{
String displayName;
String path;
}
private Uri videoListUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
private static int position ;
private static boolean backFromAD = false;
private int playedTime;
private AdView adView;
private VideoView vv = null;
private SeekBar seekBar = null;
private TextView durationTextView = null;
private TextView playedTextView = null;
private GestureDetector mGestureDetector = null;
private AudioManager mAudioManager = null;
private int maxVolume = 0;
private int currentVolume = 0;
private ImageButton bn1 = null;
private ImageButton bn2 = null;
private ImageButton bn3 = null;
private ImageButton bn4 = null;
private ImageButton bn5 = null;
private View controlView = null;
private PopupWindow controler = null;
private SoundView mSoundView = null;
private PopupWindow mSoundWindow = null;
private View extralView = null;
private PopupWindow extralWindow = null;
private static int screenWidth = 0;
private static int screenHeight = 0;
private static int controlHeight = 0;
private final static int TIME = 6868;
private boolean isControllerShow = true;
private boolean isPaused = false;
private boolean isFullScreen = false;
private boolean isSilent = false;
private boolean isSoundShow = false;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d("OnCreate", getIntent().toString());
Looper.myQueue().addIdleHandler(new IdleHandler(){
@Override
public boolean queueIdle() {
// TODO Auto-generated method stub
if(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);
return false;
}
});
controlView = getLayoutInflater().inflate(R.layout.controler, null);
controler = new PopupWindow(controlView);
durationTextView = (TextView) controlView.findViewById(R.id.duration);
playedTextView = (TextView) controlView.findViewById(R.id.has_played);
mSoundView = new SoundView(this);
mSoundView.setOnVolumeChangeListener(new OnVolumeChangedListener(){
@Override
public void setYourVolume(int index) {
cancelDelayHide();
updateVolume(index);
hideControllerDelay();
}
});
mSoundWindow = new PopupWindow(mSoundView);
extralView = getLayoutInflater().inflate(R.layout.extral, null);
extralWindow = new PopupWindow(extralView);
ImageButton backButton = (ImageButton) extralView.findViewById(R.id.back);
ImageButton aboutButton = (ImageButton) extralView.findViewById(R.id.about);
position = -1;
backButton.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
VideoPlayerActivity.this.finish();
}
});
aboutButton.setOnClickListener(new OnClickListener(){
Dialog dialog;
OnClickListener mClickListener = new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d("DIALOG", "DISMISS");
dialog.dismiss();
//vv.seekTo(msec);
vv.start();
}
};
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
/*Intent intent = new Intent();
intent.setClass(VideoPlayerActivity.this, VideoChooseActivity.class);
VideoPlayerActivity.this.startActivityForResult(intent, 0);*/
dialog = new Dialog(VideoPlayerActivity.this, R.style.transDialog);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
View view = VideoPlayerActivity.this.getLayoutInflater().inflate(R.layout.about, null);
dialog.setContentView(view);
view.findViewById(R.id.cancel).setOnClickListener(mClickListener);
vv.pause();
dialog.show();
cancelDelayHide();
}
});
bn1 = (ImageButton) controlView.findViewById(R.id.button1);
bn2 = (ImageButton) controlView.findViewById(R.id.button2);
bn3 = (ImageButton) controlView.findViewById(R.id.button3);
bn4 = (ImageButton) controlView.findViewById(R.id.button4);
bn5 = (ImageButton) controlView.findViewById(R.id.button5);
vv = (VideoView) findViewById(R.id.vv);
vv.setOnErrorListener(new OnErrorListener(){
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
vv.stopPlayback();
isOnline = false;
new AlertDialog.Builder(VideoPlayerActivity.this)
.setTitle("对不起")
.setMessage("您所播的视频格式不正确,播放已停止。")
.setPositiveButton("知道了",
new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
vv.stopPlayback();
}
})
.setCancelable(false)
.show();
return false;
}
});
Uri uri = getIntent().getData();
if(uri!=null){
vv.stopPlayback();
没有合适的资源?快使用搜索试试~ 我知道了~
android视频播放器自定义View
共82个文件
class:46个
xml:11个
png:11个
5星 · 超过95%的资源 需积分: 0 247 下载量 102 浏览量
2013-06-17
22:13:27
上传
评论
收藏 396KB RAR 举报
温馨提示
android视频播放器自定义View 流媒体播放 自定义进度条 声音控制
资源推荐
资源详情
资源评论
收起资源包目录
SeeJoPlayer_v1.2.0_beta_SourceCode.rar (82个子文件)
SeeJoPlayer
.project 847B
src
com
zh_weir
videoplayer
SoundView.java 3KB
VideoChooseActivity.java 4KB
VideoView.java 21KB
VideoPlayerActivity.java 23KB
AndroidManifest.xml 2KB
res
drawable
sound_line1.BMP 1KB
stepforward.png 9KB
icon.png 11KB
contanct.png 6KB
back.png 5KB
stepbackward.png 7KB
sound_line.bmp 846B
eject.png 4KB
play.png 6KB
soundenable.png 7KB
del.png 5KB
sounddisable.png 6KB
pause.png 3KB
layout
list.xml 592B
about.xml 2KB
extral.xml 1KB
dialog.xml 2KB
controler.xml 3KB
main.xml 468B
values
color.xml 196B
style.xml 397B
attrs.xml 544B
strings.xml 239B
assets
gen
com
zh_weir
videoplayer
R.java 11KB
libs
test.jar 44KB
default.properties 449B
.classpath 332B
bin
resources.ap_ 72KB
com
zh_weir
videoplayer
R$layout.class 559B
R$style.class 450B
VideoPlayerActivity$3.class 1009B
R$drawable.class 799B
VideoPlayerActivity$2.class 1KB
VideoPlayerActivity$17.class 2KB
R$attr.class 588B
VideoView$MySizeChangeLinstener.class 266B
VideoPlayerActivity$10.class 2KB
VideoView.class 13KB
VideoChooseActivity$3.class 1KB
VideoView$5.class 899B
VideoPlayerActivity$13.class 1KB
VideoView$4.class 2KB
VideoPlayerActivity$15.class 2KB
VideoChooseActivity.class 3KB
VideoView$3.class 1KB
VideoPlayerActivity$7.class 908B
VideoPlayerActivity$12.class 2KB
VideoView$6.class 2KB
VideoPlayerActivity$1.class 2KB
VideoPlayerActivity$18.class 2KB
SoundView$OnVolumeChangedListener.class 274B
VideoChooseActivity$1.class 869B
VideoView$2.class 2KB
VideoPlayerActivity$9.class 2KB
VideoPlayerActivity$MovieInfo.class 631B
R$id.class 849B
VideoPlayerActivity$11.class 2KB
VideoPlayerActivity$5$1.class 1KB
VideoPlayerActivity$16.class 3KB
VideoPlayerActivity$4.class 866B
VideoView$1.class 2KB
VideoPlayerActivity$5.class 2KB
VideoChooseActivity$2.class 2KB
VideoPlayerActivity$8.class 1KB
R.class 733B
VideoPlayerActivity.class 17KB
R$string.class 470B
VideoPlayerActivity$6.class 2KB
VideoPlayerActivity$14.class 2KB
VideoChooseActivity$4.class 2KB
R$color.class 483B
VideoPlayerActivity$6$1.class 1KB
R$styleable.class 972B
SoundView.class 4KB
classes.dex 88KB
VideoPlayerActivity.apk 116KB
共 82 条
- 1
shuaizhimin123
- 粉丝: 4
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页