Recently, the player in the Blue Leaf Music Room is being upgraded. It is modified from the jplayer player. To improve the user experience, we want to automatically turn the page after the song is played and continue to play on the next page. After checking the next official document of the jplayer, we found that there is an end of play processing function called ended, which can only handle the end of a single song. If it is a single song or a video is played, we can jump, The code is as follows:;
ended: function(){ //User defined JS code for jump Window. location. href='URL to jump to '; }
When processing the end of the list playback, if the end processing result cannot meet the requirements, you need to modify the code of jplayer.playlist.min.js. Finally, find the next: function() function, and modify it to the following code, so that the list will automatically enter the next page after the end of playback to continue playing. If the loop playback is enabled, it will not jump.
Note: # xiapage is the ID name of the next page of the paging code, and # homepage is the ID name of the first page next:function(){var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;if(this.loop){if(index === 0 && this.shuffled && this.options.playlistOptions.shuffleOnLoop && this.playlist.length > 1) {this.shuffle(true, true);}else{this.play(index);}} else{if(index > 0){this.play(index);}else{ if($('#xiapage').attr('href')==undefined){ if($('#homepage').attr('href')==undefined){this.play(index);}else{ window.location.href=$('#homepage').attr('href'); }}else{ window.location.href=$('#xiapage').attr('href'); }}}}
Disclaimer:
Website: Click Copy to share with friends!
All content resources shared by this website, if not noted, are original by Blueleaf. If you need to reprint, please indicate the source; Please contact us in case of infringement Contact handling 。 Please understand!