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();
没有合适的资源?快使用搜索试试~ 我知道了~
小程序 乐看播放器源码.rar
共84个文件
class:46个
png:13个
xml:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 175 浏览量
2023-02-03
11:46:48
上传
评论
收藏 458KB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序 乐看播放器源码.rar (84个子文件)
1_120818221130_2.png 25KB
乐看播放器源码
.classpath 332B
assets
src
com
zh_weir
videoplayer
SoundView.java 3KB
VideoChooseActivity.java 4KB
VideoPlayerActivity.java 23KB
VideoView.java 21KB
libs
test.jar 44KB
res
values
style.xml 397B
strings.xml 239B
color.xml 196B
attrs.xml 544B
layout
main.xml 468B
list.xml 592B
controler.xml 3KB
dialog.xml 2KB
about.xml 2KB
extral.xml 1KB
drawable
eject.png 4KB
soundenable.png 7KB
sounddisable.png 6KB
sound_line1.BMP 1KB
sound_line.bmp 846B
del.png 5KB
stepbackward.png 7KB
back.png 5KB
play.png 6KB
contanct.png 6KB
pause.png 3KB
icon.png 11KB
stepforward.png 9KB
bin
VideoPlayerActivity.apk 116KB
resources.ap_ 72KB
classes.dex 88KB
com
zh_weir
videoplayer
SoundView$OnVolumeChangedListener.class 274B
SoundView.class 4KB
VideoPlayerActivity$5$1.class 1KB
VideoView$3.class 1KB
VideoView$1.class 2KB
VideoView$6.class 2KB
VideoPlayerActivity.class 17KB
R$style.class 450B
VideoPlayerActivity$6$1.class 1KB
VideoPlayerActivity$6.class 2KB
VideoPlayerActivity$10.class 2KB
VideoView$2.class 2KB
VideoView$5.class 899B
VideoChooseActivity$1.class 869B
VideoPlayerActivity$17.class 2KB
VideoView.class 13KB
R$string.class 470B
R$layout.class 559B
VideoPlayerActivity$1.class 2KB
VideoPlayerActivity$7.class 908B
R$id.class 849B
VideoChooseActivity$3.class 1KB
R$attr.class 588B
R$color.class 483B
VideoPlayerActivity$15.class 2KB
VideoPlayerActivity$3.class 1009B
VideoPlayerActivity$9.class 2KB
VideoView$MySizeChangeLinstener.class 266B
VideoChooseActivity$4.class 2KB
VideoPlayerActivity$16.class 3KB
VideoPlayerActivity$8.class 1KB
R$drawable.class 799B
VideoPlayerActivity$11.class 2KB
VideoPlayerActivity$18.class 2KB
VideoChooseActivity.class 3KB
VideoPlayerActivity$4.class 866B
VideoView$4.class 2KB
VideoPlayerActivity$12.class 2KB
R$styleable.class 972B
VideoPlayerActivity$2.class 1KB
VideoPlayerActivity$MovieInfo.class 631B
R.class 733B
VideoPlayerActivity$14.class 2KB
VideoPlayerActivity$5.class 2KB
VideoChooseActivity$2.class 2KB
VideoPlayerActivity$13.class 1KB
default.properties 449B
.project 847B
AndroidManifest.xml 2KB
gen
com
zh_weir
videoplayer
R.java 11KB
1_120818221130_1.png 32KB
共 84 条
- 1
资源评论
大富大贵7
- 粉丝: 305
- 资源: 8869
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功