E/ExtMediaPlayer-JNI: env->IsInstanceOf fails

89
June 30, 2022, at 7:10 PM

I'm trying for a month to play an audio from https url, but every time I catch the same error. I'm new in android and I don't know what to try to fix this. I suppose that it can't open/find the file by link, but have no idea how or where to check it.

This is my Activity file:

package com.example.sairamkrishna.myapplication;
import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import com.example.player.R;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class MainActivity extends Activity  {
    private Button b1,b2,b3,b4,b5;
    private ImageView iv;
    private MediaPlayer mediaPlayer;
    private double startTime = 0;
    private double finalTime = 0;
    private final Handler myHandler = new Handler();
    private final int forwardTime = 5000;
    private final int backwardTime = 5000;
    private SeekBar seekbar;
    private TextView tx1,tx2,tx3;
    public static int oneTimeOnly = 0;
    String uriSTR = "https://e-duh.ru/content/catalog/books/audiofiles/71/ns_2ue_z.mp3";
    public static boolean exist (String uriSTR){
        try {
            HttpURLConnection.setFollowRedirects( false );
            HttpURLConnection link = null;
                link = (HttpURLConnection) new URL( uriSTR ).openConnection();
                link.setRequestMethod( "HEAD" );
                return (link.getResponseCode() == HttpURLConnection.HTTP_OK);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    };
//yeah I know that this code is for checking URL but I can't find the returns(lost for it several days)

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        b1 = findViewById(R.id.button); //перемотка вперёд
        b2 = findViewById(R.id.button2);//stop
        b3 = findViewById(R.id.button3);//start
        b4 = findViewById(R.id.button4);//перемотка назад
        iv = findViewById(R.id.imageView);
        tx1 = findViewById(R.id.textView2);
        tx2 = findViewById(R.id.textView3);
        tx3 = findViewById(R.id.textView4);
        tx3.setText("Song.mp3");
       // mediaPlayer = MediaPlayer.create( MainActivity.this, R.raw.song );
        mediaPlayer = new MediaPlayer();
        Uri uri = Uri.parse( "https://e-duh.ru/content/catalog/books/audiofiles/71/ns_2ue_z.mp3" );
        try {
            mediaPlayer.reset();
            mediaPlayer.setDataSource( uriSTR );
            mediaPlayer.setAudioStreamType( AudioManager.STREAM_MUSIC );
            mediaPlayer.setOnPreparedListener( (MediaPlayer.OnPreparedListener) this );
            mediaPlayer.prepareAsync();
        } catch (IOException e) {
            e.printStackTrace();
        }
        seekbar = findViewById(R.id.seekBar);
        seekbar.setClickable(false);
        b2.setEnabled(false);
        b3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Playing  sound",Toast.LENGTH_SHORT).show();
                MediaPlayer.OnPreparedListener PrepL = new MediaPlayer.OnPreparedListener() {
                    @Override
                    public void onPrepared(MediaPlayer mediaPlayer) {
                        mediaPlayer.start();
                        finalTime = mediaPlayer.getDuration();
                    }
                };
                mediaPlayer.setOnPreparedListener(PrepL);
                startTime = mediaPlayer.getCurrentPosition();
                if (oneTimeOnly == 0) {
                    seekbar.setMax((int) finalTime);
                    oneTimeOnly = 1;
                }
                tx2.setText(String.format("%d min, %d sec",
                        TimeUnit.MILLISECONDS.toMinutes((long) finalTime),
                        TimeUnit.MILLISECONDS.toSeconds((long) finalTime) -
                                TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes((long)
                                        finalTime)))
                );
                tx1.setText(String.format("%d min, %d sec",
                        TimeUnit.MILLISECONDS.toMinutes((long) startTime),
                        TimeUnit.MILLISECONDS.toSeconds((long) startTime) -
                                TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes((long)
                                        startTime)))
                );
                seekbar.setProgress((int)startTime);
                myHandler.postDelayed(UpdateSongTime,100);
                b2.setEnabled(true);
                b3.setEnabled(false);
            }
        });
        b2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Pausing sound",Toast.LENGTH_SHORT).show();
                if(mediaPlayer.isPlaying()){
                    Log.i("PLAY ==>", "(T_T)");
                    mediaPlayer.pause();
                }
                b2.setEnabled(false);
                b3.setEnabled(true);
            }
        });
        b1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int temp = (int)startTime;
                if((temp+forwardTime)<=finalTime){
                    startTime = startTime + forwardTime;
                    mediaPlayer.seekTo((int) startTime);
                    Toast.makeText(getApplicationContext(),"You have Jumped forward 5 seconds",Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(getApplicationContext(),"Cannot jump forward 5 seconds",Toast.LENGTH_SHORT).show();
                }
            }
        });
        b4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int temp = (int)startTime;
                if((temp-backwardTime)>0){
                    startTime = startTime - backwardTime;
                    mediaPlayer.seekTo((int) startTime);
                    Toast.makeText(getApplicationContext(),"You have Jumped backward 5 seconds",Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(getApplicationContext(),"Cannot jump backward 5  seconds",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
    private final Runnable UpdateSongTime = new Runnable() {
        public void run() {
            startTime = mediaPlayer.getCurrentPosition();
            tx1.setText(String.format("%d min, %d sec",
                    TimeUnit.MILLISECONDS.toMinutes((long) startTime),
                    TimeUnit.MILLISECONDS.toSeconds((long) startTime) -
                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.
                                    toMinutes((long) startTime)))
            );
            seekbar.setProgress((int)startTime);
            myHandler.postDelayed(this, 100);
        }
    };
}

Logs:

2022-02-07 17:38:01.200 8217-8217/com.example.player E/ExtMediaPlayer-JNI: env->IsInstanceOf fails
2022-02-07 17:38:01.200 8217-8217/com.example.player E/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
2022-02-07 17:38:01.200 8217-8217/com.example.player E/ExtMediaPlayer-JNI: env->IsInstanceOf fails
2022-02-07 17:38:01.200 8217-8217/com.example.player E/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0

Manifest permisions:

<uses-permission android:name="android.permission.INTERNET" />

I'll be glad for any help.

Rent Charter Buses Company
READ ALSO
Cyclic references when converting with MapStruct. Overflow error. Context does not work

Cyclic references when converting with MapStruct. Overflow error. Context does not work

I have 2 entities, with 1-to-1 association (ProfileEntity and VCardEntity)

105
Use Log4j1 and Log4j2 in the same project

Use Log4j1 and Log4j2 in the same project

I have a project in which Log4j1 is used all over the place, I upgraded to log4j2 but there is a jar depending on Log4j1 and I cannot change it

96
How to mock StorageOptions.newBuilder()

How to mock StorageOptions.newBuilder()

Can you help me in mocking StorageOptionsnewBuilder()

96
Reduce custom object using RxJava

Reduce custom object using RxJava

I'm using RxJava, I have a list of Point and i want to calculate the distance between each point and get the sum

99