├── images ├── play.png ├── stop.png ├── playing.png └── stoped.png ├── simpleplayer.css ├── README ├── jquery.simpleplayer.min.js ├── demo.html └── jquery.simpleplayer.js /images/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanhao/Simple-Player/HEAD/images/play.png -------------------------------------------------------------------------------- /images/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanhao/Simple-Player/HEAD/images/stop.png -------------------------------------------------------------------------------- /images/playing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanhao/Simple-Player/HEAD/images/playing.png -------------------------------------------------------------------------------- /images/stoped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanhao/Simple-Player/HEAD/images/stoped.png -------------------------------------------------------------------------------- /simpleplayer.css: -------------------------------------------------------------------------------- 1 | .simple-player-container { 2 | display: inline-block; 3 | -webkit-border-radius: 5px; 4 | -moz-border-radius: 5px; 5 | border-radius: 5px; 6 | } 7 | .simple-player-container > div > ul { 8 | margin: 0; 9 | padding-left: 0; 10 | } 11 | .simpleplayer-play-control { 12 | background-image: url('images/play.png'); 13 | display: block; 14 | width: 16px; 15 | height: 16px; 16 | bottom: -5px; 17 | position: relative; 18 | } 19 | .simpleplayer-play-control:hover { 20 | background-image: url('images/playing.png'); 21 | } 22 | .simpleplayer-stop-control { 23 | background-image: url('images/stop.png'); 24 | display: block; 25 | width: 16px; 26 | height: 16px; 27 | bottom: -5px; 28 | position: relative; 29 | } 30 | .simpleplayer-stop-control:hover { 31 | background-image: url('images/stoped.png'); 32 | } 33 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Simple HTML5 Audio Player Demo 2 | 3 | Usage: 4 | 5 | It's a so simple HTML5 audio player. See the source code of this page to learn how to use it. 6 | At first you need include simpleplayer.css and jquery.simpleplayer.js. Then initialize the player after document loaded, e.g.: 7 | $(".player").player(); 8 | 9 | Options: 10 | 11 | progressbarWidth: the width of the progressbar 12 | progressbarHeight: the height of the progressbar 13 | progressbarColor: color of the progressbar 14 | progressbarBGColor: background color of the progressbar 15 | defaultVolume: volume as default 16 | Style: 17 | 18 | You can easly use CSS to style up this simple player by change of simpleplayer.css or define it in your CSS files. 19 | 20 | TODO: 21 | 22 | Video Support 23 | Volume Adjust 24 | More Control of Media 25 | Theme 26 | A befault html5 & css 3 demo page 27 | ... 28 | Let me know if you like this simple player. @yuanhao -------------------------------------------------------------------------------- /jquery.simpleplayer.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a.fn.player=function(e){var d={progressbarWidth:"200px",progressbarHeight:"5px",progressbarColor:"#22ccff",progressbarBGColor:"#eeeeee",defaultVolume:0.8};if(e){a.extend(d,e)}var c='';var b='';this.each(function(){a(this).wrap('
').parent().prepend('');var i=a(this).get(0);var h=a(this).parent().find(".start-button");var g=a(this).parent().find(".progressbar-wrapper");var f=a(this).parent().find(".progressbar");i.volume=d.defaultVolume;h.click(function(){if(i.paused){i.play();a(this).find(".simpleplayer-play-control").addClass("simpleplayer-stop-control").removeClass("simpleplayer-play-control")}else{i.pause();a(this).find(".simpleplayer-stop-control").addClass("simpleplayer-play-control").removeClass("simpleplayer-stop-control")}});g.click(function(j){if(i.duration!=0){left=a(this).offset().left;offset=j.pageX-left;percent=offset/g.width();duration_seek=percent*i.duration;i.currentTime=duration_seek}});a(i).bind("ended",function(j){i.pause();h.find(".simpleplayer-stop-control").addClass("simpleplayer-play-control").removeClass("simpleplayer-stop-control");f.css("width","0%")});a(i).bind("timeupdate",function(j){duration=this.duration;time=this.currentTime;fraction=time/duration;percent=fraction*100;if(percent){f.css("width",percent+"%")}});if(i.duration>0){a(this).parent().css("display","inline-block")}});return this}})(jQuery); 2 | -------------------------------------------------------------------------------- /demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
39 | It's a so simple HTML5 audio player. See the source code of this page to
40 | learn how to use it.
41 |
42 | At first you need include simpleplayer.css and jquery.simpleplayer.js.
43 | Then initialize the player after document loaded, e.g.:
44 |
45 |
46 | $(".player").player();
47 |
48 |
63 | You can easly use CSS to style up this simple player by change of 64 | simpleplayer.css or define it in your CSS files. 65 |
66 |