views:

292

answers:

1

I'm using JW Player 4.5 on my site and I need to add an event listener for when fullscreen is toggled.

The reason for this is to switch between a low-def version and high-def version. The default video will be the low-def version and when they switch to a fullscreen display, it will change to the high-def version.

According to http://developer.longtailvideo.com/trac/wiki/Player5Events, the ViewEvent.JWPLAYER_VIEW_FULLSCREEN1 event can only be called from Actionscript. I need it to be from Javascript...

Is there any way to achieve this? Can you recommend a better solution?

A: 

Hi Charles,

If I understand you correctly, what you're trying to do is switch from a low-def file to high-def file when the user moves into full screen. For this, you'll want to detect the fullscreen event (rather than send it). For this, you'll want to add a listener for ControllerEvent.RESIZE and look at the fullscreen property. Check out the player events page (http://developer.longtailvideo.com/trac/wiki/Player4Events) for more info.

In terms of doing the actual switch, you'll want to do a load (ViewEvent.LOAD) with the path as the argument. This can be done regardless of the fullscreen state.

Additionally, you'll probably want to seek (ViewEvent.SEEK) with the current position as the argument. I should note that this is only possible using some sort of streaming server (http or RTMP), as there's no way to seek ahead in progressively downloaded files.

However, rather than implement all of this, you could just use our built in bitrate switching (http://www.longtailvideo.com/support/jw-player/jw-flv-player-v4/27/bitrate-switching) (which performs automatic bandwidth detection) or modify the source (http://developer.longtailvideo.com/trac/browser/plugins/hd) of our HD plugin (http://www.longtailvideo.com/addons/plugins/65/HD).

Best,

Zach

Developer, LongTail Video

zach at longtail