Skip to content

Instantly share code, notes, and snippets.

@agungf
Created February 27, 2017 12:00
Show Gist options
  • Select an option

  • Save agungf/b5f45718d6cc12bf6ef9e55997ca5cfb to your computer and use it in GitHub Desktop.

Select an option

Save agungf/b5f45718d6cc12bf6ef9e55997ca5cfb to your computer and use it in GitHub Desktop.

Revisions

  1. agungf created this gist Feb 27, 2017.
    28 changes: 28 additions & 0 deletions dacast-snippet-web
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    dacast(_vid_id,"vid_here");
    _vid_player = dacast.players[_vid_id];
    // console.log(_vid_player.play());

    _vid_player.onReady(function(){
    console.log('player ready');
    // console.log('Step 2');

    _vid_player.onPlay(function(){
    // console.log('playing video');
    check_session() ? console.log('playing video') : console.log('session_expired');
    if(sInt == null)
    sInt = setInterval(function(){
    // console.log('checking session: '+ counter++);
    check_session();
    },10000);
    });
    _vid_player.onPause(function(){
    if(sInt != null) {
    clearInterval(sInt);sInt = null;
    }
    });

    _vid_player.onComplete(() => {
    alert('anda sudah selesai menonton ');
    });

    });