protected void playIndexOf(int index) { super.playIndexOf(index); if (currentVideoIndex >= playList.size()) finish(); else if (currentVideoIndex < 0) { Toast.makeText(this, "已经是第一个视频了", Toast.LENGTH_LONG).show(); } else { cancelPlayerTimer(); currentVideoIndex = index; currentVideoPath = playList.get(index); // if (videoPregressMap.containsKey(currentVideoPath)) // currentPosition = videoPregressMap.get(currentVideoPath); // else { // currentPosition = 0; // videoPregressMap.put(currentVideoPath, 0); // } if (mMoboVideoView != null) stop(); initMoboVideoView(); if (playAudioOnly) playAudioOnly(currentVideoPath, 0); else { mMoboVideoView.setIsLive(true); // 点播时可不设置 mMoboVideoView.setBufferedTime(1); // 设置缓冲时间 mMoboVideoView.setSaveBufferInfoOrNot(false); mMoboVideoView.setBufferListener(mBufferListener); // 设置缓冲回调接口 videoParams = 0 + "\n" + 0; // 播放第0个音轨+第0个字幕 setVideoPath( currentVideoPath, videoParams, MoboVideoView.decode_mode_soft); // decode_mode_hard } } }
@Override protected void onCreate( Bundle savedInstanceState) { // rtmp://61.133.116.49/flv/mp4:n2014/jxjy/kc213/kj2276/fc/gdxxkjzd201401.mp4 // share-04.MP4 playList.add( "rtsp://192.168.42.1/tmp/fuse_d/share/2015-01-13-02-26-30.MP4"); /// // NORMAL/media001/2015-01-13-03-33-10.MP4 playList.add("rtsp://192.168.42.1/tmp/fuse_d/share/2015-01-13-02-18-53.MP4"); playList.add("rtsp://192.168.42.1/live"); // playList.add("rtsp://192.168.42.1/live"); // playList.add("rtsp://192.168.42.1/live"); // playList.add("rtsp://192.168.42.1/live"); // playList.add( "rtsp://192.168.42.1/tmp/fuse_d/share/2015-01-13-03-31-36.MP4"); // 2015-01-13-03-21-17.MP4 playList.add("http://1011.lssplay.aodianyun.com/demo/stock.m3u8"); // playList.add("/sdcard/Movies/sample3.mp4"); playList.add("/sdcard/Movies/sample.mp4"); playList.add("/sdcard/Movies/sample2.mp4"); // playList.add("/sdcard/Music/当爱已成往事.mp3"); // playList.add("rtmp://61.133.116.49/flv/mp4:n2014/jxjy/kc218/kj2294/fc/kxsydwkjzd201401.mp4"); // playList.add("/sdcard/movie/情歌.mp4"); // playList.add("rtmp://61.133.116.49/flv/mp4:n2014/jxjy/kc213/kj2276/fc/gdxxkjzd201401.mp4"); // playList.add("rtsp://183.58.12.204/PLTV/88888905/224/3221227038/10000100000000060000000000657995_0.smil"); // playList.add("/sdcard/Movies/liudehua.avi"); // playList.add("/sdcard/Movies/Frozen.2013.3D.BluRay.HSBS.1080p.DTS.x264-CHD3D.mkv"); // playList.add("rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"); // playList.add("http://27.221.44.43/65722A7056C3E83624182D4CB5/0300010E0054C96DBA3EF603BAF2B16135A553-86F1-7270-8753-BBB5274B597B.flv"); // playList.add("http://localhost:8098/mobo.mkv");// 192.168.31.245 // playList.add("/sdcard/mobo_download.mkv"); // playList.add("/sdcard/Movies/[奥黛丽·赫本系列01:罗马假日].Roman.Holiday.1953.DVDRiP.X264.2Audio.AAC.HALFCD-NORM.Christian.mkv"); // playList.add("rtmp://183.62.232.213/fileList/test.flv"); // playList.add("http://flv1.vodfile.m1905.com/movie/leJ8Al00HnqXH-L2.flv"); // playList.add(path); // playList.add("/sdcard/Movies/07141635_1278.MP4"); // playList.add(""); // playList.add("rtmp://183.62.232.213/fileList/test22"); // playList.add("/storage/emulated/0/测试视频/[奥黛丽·赫本系列01:罗马假日].Roman.Holiday.1953.DVDRiP.X264.2Audio.AAC.HALFCD-NORM.Christian.mkv"); // playList.add("/storage/emulated/0/测试视频/[YYDM-11FANS][CLANNAD][BDrip][24][X264_AAC][1280X720].mkv"); // playList.add("/storage/emulated/0/测试视频/偶阵雨.mp3"); // playList.add("/storage/emulated/0/测试视频/(4K HD)2014预告片 .mp4"); // playList.add("/sdcard/Movies/[奥黛丽·赫本系列01:罗马假日].Roman.Holiday.1953.DVDRiP.X264.2Audio.AAC.HALFCD-NORM.Christian.mkv"); super.onCreate(savedInstanceState); currentVideoPath = playList.get(0); setContentView(R.layout.activity_main); initViews(); playIndexOf(0); // currentVideoIndex=-1; showFloatPlayerByHomeKey(true); setFloatPlayerListener(mFloatPlayerListener); // mMoboVideoView.scanMediaFile(playList.get(0), null, 1, 343, 234, 1); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { // mMoboVideoView.getHolder().setFixedSize( // mMoboVideoView.getVideoWidth(), // mMoboVideoView.getVideoHeight()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(2048, 1536); params.addRule(RelativeLayout.CENTER_HORIZONTAL); mMoboVideoView.setLayoutParams(params); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { // mMoboVideoView.getHolder().setFixedSize( // mMoboVideoView.getVideoWidth(), // mMoboVideoView.getVideoHeight()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1536, 1152); params.addRule(RelativeLayout.CENTER_HORIZONTAL); mMoboVideoView.setLayoutParams(params); } // displayMode--; // changePlayerScale(displayMode); }
public void onDestroy() { super.onDestroy(); }