# The τ Player API

## `startPlayerFromStream()`

* Dart API: [startPlayerFromStream()](https://github.com/Canardoux/tau/tree/6bd245d293bcf9a123677735835549585d32b2ee/doc/pages/tau-api/player/pages/flutter-sound/api/player/FlutterSoundPlayer/startPlayerFromStream.html).

**This functionnality needs, at least, and Android SDK >= 21**

* The only codec supported is actually `Codec.pcm16`.
* The only value possible for `numChannels` is actually 1.
* SampleRate is the sample rate of the data you want to play.

Please look to [the following notice](https://github.com/Canardoux/tau/tree/6bd245d293bcf9a123677735835549585d32b2ee/doc/pages/tau-api/player/guides_play_stream/README.md)

*Example* You can look to the three provided examples :

* [This example](https://github.com/Canardoux/tau/tree/6bd245d293bcf9a123677735835549585d32b2ee/doc/pages/tau-api/player/flutter_sound_examples_playback_from_stream_2/README.md) shows how to play Live data, with Back Pressure from Flutter Sound
* [This example](https://github.com/Canardoux/tau/tree/6bd245d293bcf9a123677735835549585d32b2ee/doc/pages/tau-api/player/flutter_sound_examples_playback_from_stream_1/README.md) shows how to play Live data, without Back Pressure from Flutter Sound
* [This example](https://github.com/Canardoux/tau/tree/6bd245d293bcf9a123677735835549585d32b2ee/doc/pages/tau-api/player/flutter_sound_examples_sound_effects/README.md) shows how to play some real time sound effects.

*Example 1:*

[Dart](#dart)

[Javascript](#javascript)

```

await myPlayer.startPlayerFromStream(codec: Codec.pcm16, numChannels: 1, sampleRate: 48000);

await myPlayer.feedFromStream(aBuffer);
await myPlayer.feedFromStream(anotherBuffer);
await myPlayer.feedFromStream(myOtherBuffer);

await myPlayer.stopPlayer();
    );
```

```

        Lorem ipsum ...
```

\</div>

*Example 2:*

[Dart](#dart)

[Javascript](#javascript)

```

await myPlayer.startPlayerFromStream(codec: Codec.pcm16, numChannels: 1, sampleRate: 48000);

myPlayer.foodSink.add(FoodData(aBuffer));
myPlayer.foodSink.add(FoodData(anotherBuffer));
myPlayer.foodSink.add(FoodData(myOtherBuffer));

myPlayer.foodSink.add(FoodEvent((){_mPlayer.stopPlayer();}));
```

```

        Lorem ipsum ...
```

\</div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://canardoux.gitbook.io/tau/doc/pages/tau-api/player/start_player_from_stream.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
