Note that there are some explanatory texts on larger screens.

plurals
  1. POmedia extractor show "failed to instantiate extractor"
    primarykey
    data
    text
    <p>I am trying to work on media extractor for audio streaming of OGG file format on android. I have written some code with help of google documents. but it doesn't work at all. May be i have Written a wrong code or syntax As i am student. <strong>it show me failed to instantiate extractor</strong></p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MediaExtractor extractor = new MediaExtractor(); extractor.setDataSource("http://examplelink.com/ogg");// I cant put real link so sorry for that int numTracks = extractor.getTrackCount(); for (int i = 0; i &lt; numTracks; ++i) { MediaFormat format = extractor.getTrackFormat(i); String mime = format.getString(MediaFormat.KEY_MIME); extractor.selectTrack(i); ByteBuffer inputBuffer = ByteBuffer.allocate(1024); while (extractor.readSampleData(inputBuffer,0) &gt;= 0) { int trackIndex = (int) extractor.getSampleTime(); long presentationTimeUs = extractor.getSampleTime(); } MediaCodec codec = MediaCodec.createDecoderByType(mime); codec.configure(format, null /* surface */, null /* crypto */, 0 /* flags */); codec.start(); ByteBuffer[] inputBuffers = codec.getInputBuffers(); ByteBuffer[] outputBuffers = codec.getOutputBuffers(); format = codec.getOutputFormat(); Long timeoutUs=(long) 1; for (;;) { int inputBufferIndex = codec.dequeueInputBuffer(timeoutUs); if (inputBufferIndex &gt;= 0) { // fill inputBuffers[inputBufferIndex] with valid data codec.queueInputBuffer(inputBufferIndex, 0, 128, 0,0); } MediaCodec.BufferInfo info = new BufferInfo(); int outputBufferIndex = codec.dequeueOutputBuffer(info, timeoutUs); if (outputBufferIndex &gt;= 0) { // outputBuffer is ready to be processed or rendered. codec.releaseOutputBuffer(outputBufferIndex, false); } else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { outputBuffers = codec.getOutputBuffers(); } else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { // Subsequent data will conform to new format. format = codec.getOutputFormat(); AudioTrack mAudioTrack = null; mAudioTrack.setPlaybackRate(format.getInteger(MediaFormat.KEY_SAMPLE_RATE)); } codec.stop(); codec.release(); codec = null; } } </code></pre> <p>}</p>
    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.
 

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