From 054a76a863de0e369260f3b5cbf185719c104c1e Mon Sep 17 00:00:00 2001 From: Samir Das Date: Sun, 12 Nov 2017 00:30:45 +0600 Subject: [PATCH 1/3] update readme --- README.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fe4d5d3..1e1dbc7 100644 --- a/README.md +++ b/README.md @@ -1 +1,62 @@ -Coming soon \ No newline at end of file +PCM Player +----------- +A minimalist javascript audio player for PCM streaming data for the browsers. + +**How to use?** + + var player = new PCMPlayer(option); + +Available options are: + +*encoding* - possible values 8bitInt / 16bitInt / 32bitInt / 32bitFloat default: 16bitInt + +*channels* - no of channels in opus data + +*sampleRate* - sample rate of the PCM data + +*flushingTime* - flushing interval of PCM data to be played in milisecond. Default 1000ms + +Decoder fire an event *decode* whenever it completes decoding. Usually it decodes several opus packet at a time for better performance although it need to be provided single opus packet into *decode* method. + +**Complete example:** + + var player = new PCMPlayer({ + encoding: '16bitInt', + channels: 2, + sampleRate: 8000, + flushingTime: 2000 + }); + + // Now feed PCM data into player getting from websocket or ajax whatever the transport you are using. + player.feed(pcm_data); + +**Available Methods** + +| Name | Parameter | Remark | +| ------------- |:-------------:| -----:| +| feed | - | raw PCM data | Usually get from ajax or websocket +| volume | decimal value 0.1 to 1 | For controlling volume of the player | +| destroy | - | Destroy the player instance and release the resources | + + **Compatibility** + + it is supported on: + + * Chrome for Android 34+ + * Chrome for Desktop 34+ + * Firefox for Android 41+ + * Firefox for Desktop 42+ + * IE11+ for Windows 8.1+ + * Edge for Windows 10+ + * Opera for Desktop + * Safari for Mac 8+ + * Safari for iOS 8+ + +**How to run example?** + +An example with simple node server script is available that include some raw pcm data that will be served by websocket and at the client end, it will be played through PCM player. For running the example, first run the node server by following command: + +*node server.js* + +then, visit *example/index.html* page through any webserver. + From 1d5937019aa8820d5c08adaf814e5c960ab8b72f Mon Sep 17 00:00:00 2001 From: Samir Das Date: Sun, 12 Nov 2017 00:31:23 +0600 Subject: [PATCH 2/3] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e1dbc7..fefb751 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Decoder fire an event *decode* whenever it completes decoding. Usually it decode | Name | Parameter | Remark | | ------------- |:-------------:| -----:| -| feed | - | raw PCM data | Usually get from ajax or websocket +| feed | raw PCM data | Usually get from ajax or websocket | volume | decimal value 0.1 to 1 | For controlling volume of the player | | destroy | - | Destroy the player instance and release the resources | From 8ac00068908a71d9e7153b3ec12bee4dca6dcb48 Mon Sep 17 00:00:00 2001 From: Samir Das Date: Sun, 12 Nov 2017 00:32:17 +0600 Subject: [PATCH 3/3] update readme volume --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fefb751..a1b0675 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Decoder fire an event *decode* whenever it completes decoding. Usually it decode | Name | Parameter | Remark | | ------------- |:-------------:| -----:| | feed | raw PCM data | Usually get from ajax or websocket -| volume | decimal value 0.1 to 1 | For controlling volume of the player | +| volume | decimal value 0 to 1 | For controlling volume of the player | | destroy | - | Destroy the player instance and release the resources | **Compatibility**