|
@@ -153,7 +153,7 @@ class LessonScene extends scene {
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-video">
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-video">
|
|
</div>
|
|
</div>
|
|
<div id="view-video-start" fe-role="Widget">
|
|
<div id="view-video-start" fe-role="Widget">
|
|
- <div class="transparent-btn">播放</div>
|
|
|
|
|
|
+ <div class="transparent-btn">暂停</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
`;
|
|
document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
@@ -218,7 +218,7 @@ class LessonScene extends scene {
|
|
/**
|
|
/**
|
|
* 渲染音频视图
|
|
* 渲染音频视图
|
|
*/
|
|
*/
|
|
- renderAudioView() {
|
|
|
|
|
|
+ renderAudioView(focusTarget) {
|
|
const curAudio = this.curAudioList[this.curAudioIndex];
|
|
const curAudio = this.curAudioList[this.curAudioIndex];
|
|
const { img, audio, type } = curAudio;
|
|
const { img, audio, type } = curAudio;
|
|
let imgPath = (img || {}).path || '';
|
|
let imgPath = (img || {}).path || '';
|
|
@@ -236,12 +236,12 @@ class LessonScene extends scene {
|
|
let audioElement = document.createElement('audio');
|
|
let audioElement = document.createElement('audio');
|
|
audioElement.setAttribute('id', 'courseware-audio');
|
|
audioElement.setAttribute('id', 'courseware-audio');
|
|
audioElement.setAttribute('src', audioUrl);
|
|
audioElement.setAttribute('src', audioUrl);
|
|
|
|
+ audioElement.setAttribute('autoplay', 'autoplay');
|
|
let controlsElement = document.createElement('div');
|
|
let controlsElement = document.createElement('div');
|
|
controlsElement.setAttribute('class', 'audio-controls');
|
|
controlsElement.setAttribute('class', 'audio-controls');
|
|
- controlsElement.setAttribute('fe-role', 'Switch');
|
|
|
|
let controlsBtns = `
|
|
let controlsBtns = `
|
|
<!-- 播放/暂停 -->
|
|
<!-- 播放/暂停 -->
|
|
- <div id="audio-play" class="audio-controls-item btn-play paused" fe-role="Widget"></div>
|
|
|
|
|
|
+ <div id="audio-play" class="audio-controls-item btn-play" fe-role="Widget"></div>
|
|
<!-- 有声/静音 -->
|
|
<!-- 有声/静音 -->
|
|
<div id="audio-mute" class="audio-controls-item btn-mute" fe-role="Widget"></div>
|
|
<div id="audio-mute" class="audio-controls-item btn-mute" fe-role="Widget"></div>
|
|
<!-- 下一个音频 -->
|
|
<!-- 下一个音频 -->
|
|
@@ -253,7 +253,19 @@ class LessonScene extends scene {
|
|
content.appendChild(audioElement);
|
|
content.appendChild(audioElement);
|
|
content.appendChild(controlsElement);
|
|
content.appendChild(controlsElement);
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
- //FocusEngine.getWidgetById('audio-play').focus();
|
|
|
|
|
|
+ // 监听onended事件
|
|
|
|
+ let audioDom = document.getElementById('courseware-audio');
|
|
|
|
+ if (audioDom) {
|
|
|
|
+ audioDom.addEventListener('ended', function () {
|
|
|
|
+ TVUtil.Toast.show('播放结束', 1500);
|
|
|
|
+ document.getElementById('audio-play').classList.add('paused');
|
|
|
|
+ audioDom.currentTime = 0;
|
|
|
|
+ }, false);
|
|
|
|
+ }
|
|
|
|
+ // 指定光标位置
|
|
|
|
+ if (focusTarget && this.moye.root.getWidgetById(focusTarget)) {
|
|
|
|
+ this.moye.root.getWidgetById(focusTarget).focus();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -393,13 +405,13 @@ class LessonScene extends scene {
|
|
case 'audio-next':
|
|
case 'audio-next':
|
|
if (this.curAudioIndex < this.curAudioList.length -1) {
|
|
if (this.curAudioIndex < this.curAudioList.length -1) {
|
|
this.curAudioIndex += 1;
|
|
this.curAudioIndex += 1;
|
|
- this.renderAudioView();
|
|
|
|
|
|
+ this.renderAudioView('audio-next');
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 'audio-last':
|
|
case 'audio-last':
|
|
if (this.curAudioIndex > 0) {
|
|
if (this.curAudioIndex > 0) {
|
|
this.curAudioIndex -= 1;
|
|
this.curAudioIndex -= 1;
|
|
- this.renderAudioView();
|
|
|
|
|
|
+ this.renderAudioView('audio-last');
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|