startPlayerFromStream().

The τ Player API


startPlayerFromStream()

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

Example You can look to the three provided examples :

  • This example shows how to play Live data, with Back Pressure from Flutter Sound
  • This example shows how to play Live data, without Back Pressure from Flutter Sound
  • This example shows how to play some real time sound effects.

Example 1:

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 ...

Example 2:

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 ...

Tags: api player