|
|
|
@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable; |
|
|
|
import android.media.MediaPlayer; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Handler; |
|
|
|
import android.os.Looper; |
|
|
|
import android.os.Message; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.util.Log; |
|
|
|
@ -2805,43 +2806,23 @@ class MyPresentation extends Presentation { |
|
|
|
videoPlayCount1++; |
|
|
|
} |
|
|
|
|
|
|
|
//上传播放记录
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String playTime = format.format(System.currentTimeMillis()); |
|
|
|
// ScreenSaverData.uploadPlayRecord(materials0.getMaterialCode(), materials0.getDuration(), playTime, null, null);
|
|
|
|
|
|
|
|
if(materials0.getDuration()>0){ |
|
|
|
//视频
|
|
|
|
handler.sendEmptyMessageDelayed(TYPE_UPDATE_VIDE,materials0.getDuration()*1000); |
|
|
|
Log.e("(双面屏)TAG","设置视频路径"); |
|
|
|
try { |
|
|
|
if (videoView.isPlaying()) { |
|
|
|
videoView.stopPlayback(); |
|
|
|
} |
|
|
|
new Handler(Looper.getMainLooper()).postDelayed(() -> { |
|
|
|
try { |
|
|
|
videoView.setVideoPath(localPath); |
|
|
|
|
|
|
|
//获取节目第一个视频的第一帧
|
|
|
|
|
|
|
|
// if(videoPlayCount==0){
|
|
|
|
// MediaMetadataRetriever media = new MediaMetadataRetriever();
|
|
|
|
// media.setDataSource(localPath);
|
|
|
|
// Bitmap bitmap = media.getFrameAtTime(0);
|
|
|
|
// if(bitmap==null){
|
|
|
|
// Log.e("TAG","第一帧为空");
|
|
|
|
// }else {
|
|
|
|
// String[] b = StringUtil.strSplice(Constant.CACHE_PATH, materials0.getFileUrl()).split("\\.");
|
|
|
|
// String imgUrl = b[0]+".jpg";
|
|
|
|
//
|
|
|
|
// if(!new File(imgUrl).exists()){
|
|
|
|
// try {
|
|
|
|
// FileOutputStream fileOutputStream = new FileOutputStream(imgUrl);
|
|
|
|
// bitmap.compress(Bitmap.CompressFormat.JPEG,100,fileOutputStream);
|
|
|
|
// } catch (FileNotFoundException e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// //获取视频中的第一帧照片,设置为封面
|
|
|
|
//// Bitmap bitmap = media.getFrameAtTime(1, MediaMetadataRetriever.OPTION_CLOSEST_SYNC );
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
|
|
|
} catch (IllegalStateException e) { |
|
|
|
Log.e("ViewScreenSaver", "Error setting video path", e); |
|
|
|
} |
|
|
|
}, 100); |
|
|
|
} catch (IllegalStateException e) { |
|
|
|
Log.e("ViewScreenSaver", "Error stopping video", e); |
|
|
|
} |
|
|
|
}else { |
|
|
|
//图片
|
|
|
|
if(TYPE_UPDATE_VIDE==TYPE_UPDATE_VIDEO0){ |
|
|
|
@ -2862,7 +2843,6 @@ class MyPresentation extends Presentation { |
|
|
|
handler.sendEmptyMessageDelayed(TYPE_UPDATE_VIDE,videoComponents.getConfig().getTransitionPeriod()*1000); |
|
|
|
Drawable drawable = new BitmapDrawable(localPath); |
|
|
|
videoView.setBackground(drawable); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|