Note that there are some explanatory texts on larger screens.

plurals
  1. POplay video through libsonic library in android
    primarykey
    data
    text
    <p>I am using Sonic-NDK for sound modulation in my app. for the it is working fine but just for audio files. Can it be used to play video files? Here is the <a href="https://github.com/waywardgeek/sonic-ndk" rel="nofollow"><strong>link</strong></a> to the source code of the library and my code is following though its the same but..</p> <pre><code>public class SonicTest extends Activity { VideoView videoView; String uri; FileInputStream soundFile=null; File file; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void play(View view) { new Thread(new Runnable() { public void run() { float speed= (float) 1.0; float pitch= (float) 1.5; float rate= (float) 1.0; uri= Environment.getExternalStorageDirectory().toString(); uri=uri+"/talking.bin"; Log.i("testing","check if uri is correct "+uri); AndroidAudioDevice device = new AndroidAudioDevice(22050, 1); Sonic sonic = new Sonic(22050, 1); byte samples[] = new byte[4096]; byte modifiedSamples[] = new byte[2048]; //soundFile = getContentResolver().openInputStream(Uri.parse(uri)); /*soundFile=getResources().openRawResource(R.raw.video3); Log.i("testing","check if SoundFile is correct "+soundFile); */ file= new File(uri); try { soundFile= new FileInputStream(file); Log.i("testing","check if SOUNDFILE is correct "+soundFile); } catch (FileNotFoundException e1) { Log.i("testing","File Not Supported"); e1.printStackTrace(); } int bytesRead; if(soundFile != null) { sonic.setSpeed(speed); sonic.setPitch(pitch); sonic.setRate(rate); do { try { bytesRead = soundFile.read(samples, 0, samples.length); } catch (IOException e) { e.printStackTrace(); return; } if(bytesRead &gt; 0) { sonic.putBytes(samples, bytesRead); } else { sonic.flush(); } int available = sonic.availableBytes(); if(available &gt; 0) { if(modifiedSamples.length &lt; available) { modifiedSamples = new byte[available*2]; } sonic.receiveBytes(modifiedSamples, available); device.writeSamples(modifiedSamples, available); } } while(bytesRead &gt; 0); device.flush(); } } } ).start(); }} </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload