Skip to content

Commit

Permalink
core:add many new api of the componet,optimize audio time count
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Aug 16, 2017
1 parent 81c9a04 commit 75a030f
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 85 deletions.
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016-2017 jinke.Li
Copyright (c) 2017 jinke.Li

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
60 changes: 50 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,64 @@ git clone https://github.com/lijinke666/react-3d-gallery.git
- `yarn`
- `npm run demo` run example


## Options

```javascript
import React from "react"
import ReactDOM from "react-dom"
import ReactJkMusicPlayer from "../src/index"
import FaHeadphones from "react-icons/lib/fa/headphones"

const options = {
//audio controller open text [ type `String` default 'open']
openText:"OPEN",

//audio controller close text [ type `String` default 'close']
closeText:"CLOSE",

//audio mode mini | full [type `String` default `mini`]
mode:"mini" ,

//audio name [type `String` default `name`]
name:"music Name" ,

//audio controller title [type `String | ReactNode` default <FaHeadphones/>]
controllerTitle: <FaHeadphones/>,

//audio cover [type `String` default `-`]
cover: "http://www.thailandballoonfestival.com/tibf2013/images/HugoSlider1.jpg",

//audio path [type `String` default `-`]
musicSrc:"http://so1.111ttt.com:8282/2016/1/12m/10/205101300290.m4a?tflag=1502850639&pin=13888f2d75f5f6229a8a3e818f09d195&ip=118.116.109.58#.mp3",

//audio play handle
audioPlay(currentTime,duration){
console.log(currentTime,duration);
},

//audio pause handle
audioPause(currentTime,duration){
console.log(currentTime,duration);
},

//audio ended handle
audioEnded(duration){
console.log(duration);
},

//audio play progress handle
audioProgress(currentTime,duration){
console.log(currentTime,duration);
},

//audio load faild error handle
loadAudioError(e){
console.log('err',e);
}
}

const Demo = ()=>(
<ReactJkMusicPlayer
openText="OPEN" //contorller open text type 'string' default 'open'
closeText="CLOSE" //contorller open text type 'string' default 'close'
mode="full" //music mode mini | full
name="demoName" //music name
controllerTitle= {<FaHeadphones/>} //contoller cover Title type 'string || ReactNode' default '<FaHeadphones/>'
cover="http://www.thailandballoonfestival.com/tibf2013/images/HugoSlider1.jpg" //music cover
musicSrc="http://tegos.kz/new/mp3_full/Redfoo_-_New_Thang.mp3" //music path
/>
<ReactJkMusicPlayer {...options}/>
)
ReactDOM.render(
<Demo/>,
Expand Down
58 changes: 49 additions & 9 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,56 @@ import ReactDOM from "react-dom"
import ReactJkMusicPlayer from "../src/index"
import FaHeadphones from "react-icons/lib/fa/headphones"

const options = {
//audio controller open text [ type `String` default 'open']
openText:"OPEN",

//audio controller close text [ type `String` default 'close']
closeText:"CLOSE",

//audio mode mini | full [type `String` default `mini`]
mode:"mini" ,

//audio name [type `String` default `name`]
name:"music Name" ,

//audio controller title [type `String | ReactNode` default <FaHeadphones/>]
controllerTitle: <FaHeadphones/>,

//audio cover [type `String` default `-`]
cover: "http://www.thailandballoonfestival.com/tibf2013/images/HugoSlider1.jpg",

//audio path [type `String` default `-`]
musicSrc:"http://so1.111ttt.com:8282/2016/1/12m/10/205101300290.m4a?tflag=1502850639&pin=13888f2d75f5f6229a8a3e818f09d195&ip=118.116.109.58#.mp3",

//audio play handle
audioPlay(currentTime,duration){
console.log(currentTime,duration);
},

//audio pause handle
audioPause(currentTime,duration){
console.log(currentTime,duration);
},

//audio ended handle
audioEnded(duration){
console.log(duration);
},

//audio play progress handle
audioProgress(currentTime,duration){
console.log(currentTime,duration);
},

//audio load faild error handle
loadAudioError(e){
console.log('err',e);
}
}

const Demo = ()=>(
<ReactJkMusicPlayer
openText="OPEN"
closeText="CLOSE"
mode="full" //music mode mini | full
name="demoName" //music name
controllerTitle= {<FaHeadphones/>}
cover="http://www.thailandballoonfestival.com/tibf2013/images/HugoSlider1.jpg" //music cover
musicSrc="http://tegos.kz/new/mp3_full/Redfoo_-_New_Thang.mp3" //music path
/>
<ReactJkMusicPlayer {...options}/>
)
ReactDOM.render(
<Demo/>,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "react-jinke-music-player",
"version": "0.3.3",
"version": "1.2.0",
"main": "src/index.js",
"scripts": {
"start":"npm run demo",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --progress --config ./example/webpack.config.js",
"demo": "webpack-dev-server --progress --config ./example/webpack.config.js"
Expand Down
Loading

0 comments on commit 75a030f

Please sign in to comment.