Flowplayer auto focus with JS (FF too)

I was asked to find a way to enable auto focus on flowplayer without the user to click anything at all. After much search and thought… I figured out an easy way to do this using the Flowplayer API and JS.
In this example I give auto focus the moment the player is done loading in HTML and by pressing num-key: “2” it toggles FullScreen.

note: This works on Firefox too.

("player", "../flowplayer/flowplayer.commercial-3.2.5.swf", {
clip: {
url: 'SOMEURL',
provider: 'rtmp',
},
onLoad:function(){
window.document.playerElementID.focus();
},
onKeyPress:(function(e){
if(e == 50){
this.toggleFullscreen();
}
}),
plugins: {
rtmp: {
url: '../flowplayer/flowplayer.rtmp-3.2.3.swf',
netConnectionUrl: 'rtmp://SOMEURL'
}
}
});

Special thanks to @Havoc24k

Facebooktwittergoogle_pluspinterestlinkedin
linkedin