StupidBeauty
Read times:857Posted at:Thu Aug 22 05:19:22 2013
- no title specified

转载:Android提高第二十一篇之MediaPlayer播放网络视频

安卓开发中,可使用MediaPlayer和SurfaceView结合的方式来播放视频文件,这比直接使用VideoView要复杂点,但是更灵活,并且某些情况下不得不这样处理。

http://www.apkbus.com/android-23967-1-1.html

亮点:

@Override

  • •. public void surfaceCreated(SurfaceHolder arg0) {

  • •. try {

  • •. mediaPlayer = new MediaPlayer();

  • •. mediaPlayer.setDisplay(surfaceHolder);

  • •. mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

  • •. mediaPlayer.setOnBufferingUpdateListener(this);

  • •. mediaPlayer.setOnPreparedListener(this);

  • •. } catch (Exception e) {

  • •. Log.e("mediaPlayer", "error", e);

  • •. }

  • •. Log.e("mediaPlayer", "surface created");

  • •. }

  • •.

以二进制形式打开文件文件

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4