类android.media.MediaPlayer.OnPreparedListener源码实例Demo

下面列出了怎么用android.media.MediaPlayer.OnPreparedListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Android-Basics-Codes   文件: MusicService.java
public void play(){
		//�������״̬
		player.reset();
		try {
			//����Ҫ���ŵ�����
			player.setDataSource("sdcard/zxmzf.mp3");
//			player.setDataSource("http://192.168.1.100:8080/bzj.mp3");
			//ͬ��׼��
//			player.prepare();
			//�첽׼��
			player.prepareAsync();
			player.setOnPreparedListener(new OnPreparedListener() {
				
				//�첽׼�����ʱ���˷�������
				@Override
				public void onPrepared(MediaPlayer mp) {
					player.start();
					addTimer();
				}
			});
//			player.start();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
	}
 
源代码2 项目: BotLibre   文件: ChatActivity.java
public void playVideo(String video, boolean loop) {
		if(!isPlaying){
			if (loop) {
				videoView.setOnPreparedListener(new OnPreparedListener() {
					@Override
					public void onPrepared(MediaPlayer mp) {
						mp.setLooping(true);
					}
				});
			}
			try {
				Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
				if (videoUri == null) {
					if(MainActivity.online){videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());}
				}
				videoView.setVideoURI(videoUri);
				videoView.start();
			} catch (Exception exception) {
				Log.wtf(exception.toString(), exception);
			}
			isPlaying = true;//to Play this video only once.
		}
}
 
源代码3 项目: BotLibre   文件: AvatarTestActivity.java
public void playVideo(String video, boolean loop) {
	System.out.println("playVideo:" + video);
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		System.out.println("videoUri:" + videoUri);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			System.out.println("null videoUri:" + videoUri);
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码4 项目: BotLibre   文件: AvatarMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码5 项目: BotLibre   文件: ChatActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码6 项目: BotLibre   文件: ChatActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			if (MainActivity.online) {
				videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			}
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码7 项目: BotLibre   文件: AvatarTestActivity.java
public void playVideo(String video, boolean loop) {
	System.out.println("playVideo:" + video);
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		System.out.println("videoUri:" + videoUri);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			System.out.println("videoUri:" + videoUri);
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码8 项目: BotLibre   文件: AvatarMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码9 项目: BotLibre   文件: GraphicMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码10 项目: BotLibre   文件: ChatActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			if (MainActivity.online) {
				videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			}
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码11 项目: BotLibre   文件: AvatarTestActivity.java
public void playVideo(String video, boolean loop) {
	System.out.println("playVideo:" + video);
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		System.out.println("videoUri:" + videoUri);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			System.out.println("videoUri:" + videoUri);
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码12 项目: BotLibre   文件: AvatarMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码13 项目: BotLibre   文件: GraphicMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码14 项目: BotLibre   文件: ChatActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码15 项目: BotLibre   文件: AvatarTestActivity.java
public void playVideo(String video, boolean loop) {
	System.out.println("playVideo:" + video);
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		System.out.println("videoUri:" + videoUri);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
			System.out.println("videoUri:" + videoUri);
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码16 项目: BotLibre   文件: AvatarMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
源代码17 项目: BotLibre   文件: GraphicMediaActivity.java
public void playVideo(String video, boolean loop) {
	if (loop) {
		videoView.setOnPreparedListener(new OnPreparedListener() {
			@Override
			public void onPrepared(MediaPlayer mp) {
				mp.setLooping(true);
			}
		});
	}
	try {
		Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
		if (videoUri == null) {
			videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
		}
		videoView.setVideoURI(videoUri);
		videoView.start();
	} catch (Exception exception) {
		Log.wtf(exception.toString(), exception);
	}
}
 
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);

	// Get a reference to the VideoView
	
	mVideoView = (VideoView) findViewById(R.id.videoViewer);

	// Add a Media controller to allow forward/reverse/pause/resume 
	
	final MediaController mMediaController = new MediaController(
			AudioVideoVideoPlayActivity.this, true);
	
	mMediaController.setEnabled(false);

	mVideoView.setMediaController(mMediaController);
	
	mVideoView
			.setVideoURI(Uri
					.parse("android.resource://course.examples.AudioVideo.VideoPlay/raw/moon"));
	
	// Add an OnPreparedListener to enable the MediaController once the video is ready
	mVideoView.setOnPreparedListener(new OnPreparedListener() {

		@Override
		public void onPrepared(MediaPlayer mp) {
			mMediaController.setEnabled(true);
		}
	});
}
 
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);

	// Get a reference to the VideoView
	
	mVideoView = findViewById(R.id.videoViewer);

	// Add a Media controller to allow forward/reverse/pause/resume 
	
	final MediaController mMediaController = new MediaController(
			AudioVideoVideoPlayActivity.this, true);
	
	mMediaController.setEnabled(false);

	mVideoView.setMediaController(mMediaController);
	
	mVideoView
			.setVideoURI(Uri
					.parse("android.resource://" + getPackageName() + "/raw/moon"));

	
	// Add an OnPreparedListener to enable the MediaController once the video is ready
	mVideoView.setOnPreparedListener(new OnPreparedListener() {

		@Override
		public void onPrepared(MediaPlayer mp) {
			mMediaController.setEnabled(true);
		}
	});
}
 
源代码20 项目: libvlc-android-sdk   文件: VideoView.java
public void setOnPreparedListener(OnPreparedListener l) {
}
 
源代码21 项目: letv   文件: VideoViewH264m3u8.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码22 项目: letv   文件: VideoViewH264LeMobile.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码23 项目: letv   文件: VideoViewH264m3u8Hw.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码24 项目: letv   文件: VideoViewH264m3u8HwLeMobile.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码25 项目: letv   文件: VideoViewH264mp4.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码26 项目: letv   文件: VideoViewTV.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码27 项目: letv   文件: VideoViewH264m3u8_4D.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码28 项目: letv   文件: VideoViewH264LeMobile_4D.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码29 项目: letv   文件: VideoViewH264mp4_4D.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
源代码30 项目: letv   文件: VideoViewH264m3u8Hw_4D.java
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
 
 类所在包
 类方法
 同包方法