Typescript初心者です。
もともとjqueryで作成していたvideoタグのjqueryで、liタグを押すとcurrentTimeを変更したいと思っているのですが、
Uncaught TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.
というエラーで進みません。
currentTimeの値を書き換えるメソッドなどがあるのでしょうか...?
ご存知の方いらっしゃいましたらご教示下さい。
よろしくお願いします。
html
1<div class="videoWrapper"> 2 <video class="app_movie" id="x_apps_movie" src="/img/chapter.mp4" autoplay controls playsinline> </video> 3 <ul class="chapterControls"> 4 <li class="is-active chapterList"><span class="chapterList__title">Chapter1</span></li> 5 <li class="is-active chapterList"><span class="chapterList__title">Chapter1</span></li> 6 <li class="is-active chapterList"><span class="chapterList__title">Chapter1</span></li> 7 <li class="is-active chapterList"><span class="chapterList__title">Chapter1</span></li> 8 </ul> 9</div>
typescript
1module Movie { 2 var main = { 3 init : function(){ 4 this.selectChapter(); 5 }, 6 selectChapter : function () { 7 $('.chapterList').on('click', function() { 8 var chapterSec = [0, 10, 20, 25]; 9 var index = $('li.chapterList').index(this); 10 $('.chapterList').removeClass('is-active'); 11 $(this).addClass('is-active'); 12 main.moveChapter(chapterSec[index]); 13 }); 14 }, 15 moveChapter : function (seconds) { 16 var video = $('#x_apps_movie').get(0); 17 // console.log(seconds); -> 各配列のchapterSecが返ってくる 18 $(video).prop('currentTime', seconds); 19 } 20 } 21 $(document).on('ready', function(){ 22 main.init(); 23 }) 24}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/30 17:21