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();
没有合适的资源?快使用搜索试试~ 我知道了~
andorid_多媒体播放器.rar
共1241个文件
c:694个
h:331个
class:46个
需积分: 5 0 下载量 133 浏览量
2024-03-22
10:14:47
上传
评论
收藏 12.65MB RAR 举报
温馨提示
andorid_多媒体播放器.rar
资源推荐
资源详情
资源评论
收起资源包目录
andorid_多媒体播放器.rar (1241个子文件)
ffplay1.7z 2.43MB
ffplay1.apk.7z 2.16MB
resources.ap_ 72KB
ffplay.apk 2.17MB
VideoPlayerActivity.apk 116KB
sound_line1.BMP 1KB
sound_line.bmp 846B
dsputil.c 161KB
snow.c 159KB
postprocess_template.c 157KB
mpegvideo_enc.c 139KB
swscale_template.c 138KB
vorbis_data.c 134KB
h264.c 126KB
vc1dec.c 122KB
utils.c 115KB
rgb2rgb_template.c 112KB
mpegvideo.c 91KB
mpeg12.c 89KB
mov.c 87KB
mpeg4videodec.c 85KB
msmpeg4data.c 83KB
wmavoice.c 80KB
mpegaudiodec.c 79KB
motion_est.c 78KB
vp3.c 77KB
aacdec.c 75KB
movenc.c 74KB
ra144.c 73KB
rtsp.c 72KB
mxfenc.c 72KB
h264_cabac.c 70KB
swscale.c 70KB
matroskadec.c 68KB
qdm2.c 67KB
aacsbr.c 66KB
adpcm.c 62KB
aactab.c 62KB
msmpeg4.c 61KB
wmaprodec.c 60KB
vorbis_dec.c 60KB
eac3dec_data.c 60KB
alsdec.c 56KB
utils.c 55KB
rv34.c 54KB
mpegts.c 54KB
postprocess_altivec_template.c 54KB
ac3dec.c 52KB
mjpegdec.c 52KB
dca.c 48KB
huffyuv.c 48KB
indeo3.c 47KB
dsputil_iwmmxt_rnd_template.c 47KB
dv.c 46KB
mpeg4videoenc.c 46KB
ivi_common.c 46KB
options.c 45KB
motion_est_template.c 44KB
asfdec.c 44KB
cook.c 43KB
jrevdct.c 43KB
error_resilience.c 43KB
imgconvert.c 42KB
mpegenc.c 42KB
ac3enc.c 41KB
dnxhddata.c 40KB
dvbsubdec.c 40KB
aaccoder.c 40KB
avidec.c 40KB
amrnbdec.c 39KB
h264pred.c 39KB
svq3.c 39KB
mlpdec.c 38KB
ps.c 38KB
flacenc.c 38KB
mxfdec.c 38KB
utils.c 37KB
postprocess.c 37KB
h264_cavlc.c 37KB
matroskaenc.c 37KB
ffv1.c 37KB
twinvq.c 36KB
ituh263dec.c 36KB
h264_loopfilter.c 35KB
vc1.c 35KB
wavpack.c 34KB
mpeg12enc.c 34KB
vorbis_enc.c 34KB
rtmpproto.c 34KB
raw.c 33KB
interplayvideo.c 33KB
bink.c 32KB
ratecontrol.c 32KB
atrac3.c 32KB
wmadec.c 31KB
roqvideoenc.c 31KB
rmdec.c 31KB
asfenc.c 30KB
bgmc.c 29KB
nutdec.c 29KB
共 1241 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
saltedfish404
- 粉丝: 887
- 资源: 403
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 当然,我将为您提供一个带有详细注释的个人简介网页HTML和CSS代码示例 这将帮助您理解每一部分代码的功能 HTML代码 (
- 当然,我将为您提供一个带有详细注释的个人简介网页HTML和CSS代码示例 这将帮助您理解每一部分代码的功能 HTML代码 (
- 当然,我将为您提供一个带有详细注释的个人简介网页HTML和CSS代码示例 这将帮助您理解每一部分代码的功能 HTML代码 (
- 网络安全odel-for-network-ids-开发笔记
- jupyter notebook2023C-maste开发笔记
- C数据库课程设计mysqlCUMCM-2023C开发笔记
- 瑞萨ntion-model-for-network-ids-开发笔记
- 基于stm32的毕业设计n-model-for-network-id开发笔记
- 数据库课程设计mysqlUMCM-2023C开发笔记
- 模拟退火算法matlab代码-model-for-network-i开发笔记p
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功