Use Keyboard Nextsong Key and Previoussong Key.

Tutorials, tips and tricks.

Moderator: moderators

Use Keyboard Nextsong Key and Previoussong Key.

Postby rodb » Tue Jul 26, 2011 5:13 pm

Hello i dont know if this was already posted before but id like to share this.

You can use the keys on your keyboard to let the player go to the next or previous songs.


Image

in /jetty/????/webapp/WEB-INF/jsp you go to playlist.jsp.

Under
Code: Select all

<body class="bgcolor2 playlistframe" onload="init()">


You add
Code: Select all
<body onKeyDown="showKeyCode(event)">


Under
Code: Select all
<script type="text/javascript" language="javascript">
    var player = null;
    var songs = null;
    var currentAlbumUrl = null;
    var currentStreamUrl = null;
    var startPlayer = false;
    var repeatEnabled = false;
    var slider = null;


You add
Code: Select all
function showKeyCode(event) {
   if(event.keyCode == 176) {
   javascript:noop();
   onNext(false);
}

if(event.keyCode == 177) {
   javascript:noop();
   onPrevious();
   }
}


Save it and reload your browser.

This only works if the browser is an activewindow..


To check other keys add
Code: Select all
alert(event.keyCode);


Under
Code: Select all
function showKeyCode(event) {



Your Suggestions are welcome.

Robert :D
rodb
 
Posts: 1
Joined: Fri Feb 18, 2011 7:58 am

Postby csobsidian » Wed Aug 10, 2011 2:58 pm

I've been looking for an answer to this as well. Currently, as far as I have determined there is no way to do this easily. I do, however, plan on writing a plugin for JWPlayer that would add this functionality. Hang tight and I'll post back here when I have it completed.
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

Postby csobsidian » Wed Aug 10, 2011 5:53 pm

As I feared, the plugin ended up operating the same way. A realization should be made that this is by design. Wouldn't it be kind of nasty if I could write a flash application that silently ran in the background, recording the key strokes you made as long as you had your browser open? Speaking merely for Windows users, it would be nice to see flash be able to capture the windows messages generated by the keypress (e.g. VM_APPCOMMAND 46, VK_MEDIA_PLAY, etc.). Considering the ubiquity of multimedia keyboards and the lack of support thus far, I would say there probably isn't a workaround for the time being. I'm sure we aren't the first to want this feature.
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 12 guests