修复闹钟不自动播放问题
This commit is contained in:
@@ -59,7 +59,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
ConstraintLayout cl_vp;
|
||||
@BindView(R.id.jz_video)
|
||||
JzvdStdAssert jz_video;
|
||||
@BindView(R.id.imageView)
|
||||
@BindView(R.id.iv_cover)
|
||||
ImageView imageView;
|
||||
|
||||
private AlarmClockData alarmClockData;
|
||||
@@ -75,6 +75,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_notice);
|
||||
Log.e(TAG, "onCreate: " );
|
||||
ButterKnife.bind(this);
|
||||
Intent intent = getIntent();
|
||||
code = intent.getIntExtra("id", -1);
|
||||
@@ -100,6 +101,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showData(AlarmClockData alarmClockData) {
|
||||
Log.e(TAG, "showData: " );
|
||||
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||
@@ -202,6 +204,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
jz_video.startPreloading();
|
||||
jz_video.startVideoAfterPreloading();
|
||||
jz_video.startVideo();
|
||||
|
||||
}
|
||||
} else {
|
||||
cl_vp.setVisibility(View.GONE);
|
||||
@@ -211,6 +214,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
super.onDestroy();
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
@@ -223,6 +227,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
if (Jzvd.backPress()) {
|
||||
return;
|
||||
}
|
||||
@@ -230,8 +235,9 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
protected void onStop() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
super.onStop();
|
||||
Jzvd.releaseAllVideos();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user