Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change video (and start playing immediately) in Flowplayer via Javascript?

It should change the video and start playing regardless of whether or not a video is currently loaded and playing.

Thanks.

like image 716
Larsenal Avatar asked Jan 23 '23 12:01

Larsenal


2 Answers

See example below where api is your flowplayer instance and replaceclip is the one you want to start plating

var api = flashembed("player", {src:'FlowPlayerDark.swf'}, {config: ...}});
var replaceclip = {'url':'myvideo.mp4', 'autoplay':true};

<button onClick="api.playClip(replaceclip)">Play</button>
like image 61
Josh Avatar answered Jan 26 '23 03:01

Josh


See my example in Github https://github.com/Teaonly/android-eye/blob/master/assets/droideye.js

var initAudioPlayer = function () {
    // install flowplayer into container
    // http://flash.flowplayer.org/

    $f("player", "flowplayer-3.2.15.swf", {
        plugins: {
            controls: {
                fullscreen: false,
                height: 30,
                autoHide: false,
                play: false,
            }
        },
        clip: {
            autoPlay: false,
            url: "stream/live.mp3",
        }
    });

    audioPlayer = $f();
};

var newClip = {'url':'stream/live.mp3?id='+audioCount,'autoplay':true};
audioCount ++;
audioPlayer.play(newClip);
like image 23
Zhou Chang Avatar answered Jan 26 '23 03:01

Zhou Chang