MediaPlayerNative: error (1, -2147483648) when playing HTTP progressive MP3 stream












0















I've been trying so hard to develop an Internet radio Streaming app, but all I get it some force closes or errors.
Steps I've taken,




  • I've read the MediaPlayer Documentation here.

  • I've also read the already available solutions here.

  • I've also searched google for any solutions but found none.


Here is my code:



MainActivity:



    private Button pbutton;
private MediaPlayer mediaPlayer;

pbutton = findViewById(R.id.button_play);
pbutton.setEnabled(false);

mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource("http://streams.abidingradio.org:7800/1");
} catch (IOException e) {
e.printStackTrace();
}
mediaPlayer.prepareAsync();

mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
pbutton.setEnabled(true);
}
});

pbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mediaPlayer.start();
}
});


Manifest:



<?xml version="1.0" encoding="utf-8"?>




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

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>




When I run this code, MediaPlayer is not getting prepared.
And it throws the following errors:
click here for the full log
the main errors are:



failed to init data from source
MediaPlayerNative: error (1, -2147483648)
MediaPlayer: Error (1,-2147483648)


I've been dealing with this problem for almost three days but still haven't found a solution. I can also assure that the link of the audio stream is working perfectly.



Any help would be greatly appreciated!



Thank you.










share|improve this question





























    0















    I've been trying so hard to develop an Internet radio Streaming app, but all I get it some force closes or errors.
    Steps I've taken,




    • I've read the MediaPlayer Documentation here.

    • I've also read the already available solutions here.

    • I've also searched google for any solutions but found none.


    Here is my code:



    MainActivity:



        private Button pbutton;
    private MediaPlayer mediaPlayer;

    pbutton = findViewById(R.id.button_play);
    pbutton.setEnabled(false);

    mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    try {
    mediaPlayer.setDataSource("http://streams.abidingradio.org:7800/1");
    } catch (IOException e) {
    e.printStackTrace();
    }
    mediaPlayer.prepareAsync();

    mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
    pbutton.setEnabled(true);
    }
    });

    pbutton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    mediaPlayer.start();
    }
    });


    Manifest:



    <?xml version="1.0" encoding="utf-8"?>




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

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    </application>




    When I run this code, MediaPlayer is not getting prepared.
    And it throws the following errors:
    click here for the full log
    the main errors are:



    failed to init data from source
    MediaPlayerNative: error (1, -2147483648)
    MediaPlayer: Error (1,-2147483648)


    I've been dealing with this problem for almost three days but still haven't found a solution. I can also assure that the link of the audio stream is working perfectly.



    Any help would be greatly appreciated!



    Thank you.










    share|improve this question



























      0












      0








      0








      I've been trying so hard to develop an Internet radio Streaming app, but all I get it some force closes or errors.
      Steps I've taken,




      • I've read the MediaPlayer Documentation here.

      • I've also read the already available solutions here.

      • I've also searched google for any solutions but found none.


      Here is my code:



      MainActivity:



          private Button pbutton;
      private MediaPlayer mediaPlayer;

      pbutton = findViewById(R.id.button_play);
      pbutton.setEnabled(false);

      mediaPlayer = new MediaPlayer();
      mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
      try {
      mediaPlayer.setDataSource("http://streams.abidingradio.org:7800/1");
      } catch (IOException e) {
      e.printStackTrace();
      }
      mediaPlayer.prepareAsync();

      mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
      @Override
      public void onPrepared(MediaPlayer mp) {
      pbutton.setEnabled(true);
      }
      });

      pbutton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      mediaPlayer.start();
      }
      });


      Manifest:



      <?xml version="1.0" encoding="utf-8"?>




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

      <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>




      When I run this code, MediaPlayer is not getting prepared.
      And it throws the following errors:
      click here for the full log
      the main errors are:



      failed to init data from source
      MediaPlayerNative: error (1, -2147483648)
      MediaPlayer: Error (1,-2147483648)


      I've been dealing with this problem for almost three days but still haven't found a solution. I can also assure that the link of the audio stream is working perfectly.



      Any help would be greatly appreciated!



      Thank you.










      share|improve this question
















      I've been trying so hard to develop an Internet radio Streaming app, but all I get it some force closes or errors.
      Steps I've taken,




      • I've read the MediaPlayer Documentation here.

      • I've also read the already available solutions here.

      • I've also searched google for any solutions but found none.


      Here is my code:



      MainActivity:



          private Button pbutton;
      private MediaPlayer mediaPlayer;

      pbutton = findViewById(R.id.button_play);
      pbutton.setEnabled(false);

      mediaPlayer = new MediaPlayer();
      mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
      try {
      mediaPlayer.setDataSource("http://streams.abidingradio.org:7800/1");
      } catch (IOException e) {
      e.printStackTrace();
      }
      mediaPlayer.prepareAsync();

      mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
      @Override
      public void onPrepared(MediaPlayer mp) {
      pbutton.setEnabled(true);
      }
      });

      pbutton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      mediaPlayer.start();
      }
      });


      Manifest:



      <?xml version="1.0" encoding="utf-8"?>




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

      <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>




      When I run this code, MediaPlayer is not getting prepared.
      And it throws the following errors:
      click here for the full log
      the main errors are:



      failed to init data from source
      MediaPlayerNative: error (1, -2147483648)
      MediaPlayer: Error (1,-2147483648)


      I've been dealing with this problem for almost three days but still haven't found a solution. I can also assure that the link of the audio stream is working perfectly.



      Any help would be greatly appreciated!



      Thank you.







      android android-studio android-mediaplayer internet-radio






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 30 '18 at 14:57









      Brad

      114k27230392




      114k27230392










      asked Nov 21 '18 at 8:51









      Jerome MarshallJerome Marshall

      104




      104
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The cause is MediaPlayer doesn't support streaming MPEGA format. Take a look into supported audio formats.



          Just use one of third-party players, which are compatible with, like IjkPlayer
          or ExoPlayer






          share|improve this answer
























          • Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

            – Jerome Marshall
            Nov 21 '18 at 13:50













          • "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

            – Onix
            Nov 21 '18 at 14:03













          • Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

            – Jerome Marshall
            Nov 21 '18 at 14:21











          • Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

            – Jerome Marshall
            Nov 21 '18 at 16:09













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408277%2fmediaplayernative-error-1-2147483648-when-playing-http-progressive-mp3-stre%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The cause is MediaPlayer doesn't support streaming MPEGA format. Take a look into supported audio formats.



          Just use one of third-party players, which are compatible with, like IjkPlayer
          or ExoPlayer






          share|improve this answer
























          • Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

            – Jerome Marshall
            Nov 21 '18 at 13:50













          • "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

            – Onix
            Nov 21 '18 at 14:03













          • Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

            – Jerome Marshall
            Nov 21 '18 at 14:21











          • Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

            – Jerome Marshall
            Nov 21 '18 at 16:09


















          0














          The cause is MediaPlayer doesn't support streaming MPEGA format. Take a look into supported audio formats.



          Just use one of third-party players, which are compatible with, like IjkPlayer
          or ExoPlayer






          share|improve this answer
























          • Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

            – Jerome Marshall
            Nov 21 '18 at 13:50













          • "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

            – Onix
            Nov 21 '18 at 14:03













          • Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

            – Jerome Marshall
            Nov 21 '18 at 14:21











          • Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

            – Jerome Marshall
            Nov 21 '18 at 16:09
















          0












          0








          0







          The cause is MediaPlayer doesn't support streaming MPEGA format. Take a look into supported audio formats.



          Just use one of third-party players, which are compatible with, like IjkPlayer
          or ExoPlayer






          share|improve this answer













          The cause is MediaPlayer doesn't support streaming MPEGA format. Take a look into supported audio formats.



          Just use one of third-party players, which are compatible with, like IjkPlayer
          or ExoPlayer







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 12:12









          OnixOnix

          4578




          4578













          • Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

            – Jerome Marshall
            Nov 21 '18 at 13:50













          • "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

            – Onix
            Nov 21 '18 at 14:03













          • Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

            – Jerome Marshall
            Nov 21 '18 at 14:21











          • Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

            – Jerome Marshall
            Nov 21 '18 at 16:09





















          • Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

            – Jerome Marshall
            Nov 21 '18 at 13:50













          • "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

            – Onix
            Nov 21 '18 at 14:03













          • Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

            – Jerome Marshall
            Nov 21 '18 at 14:21











          • Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

            – Jerome Marshall
            Nov 21 '18 at 16:09



















          Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

          – Jerome Marshall
          Nov 21 '18 at 13:50







          Thanks for your suggestion. But I don't think the issue is with the audio stream. Because, I used the same audio stream link in another sample app from GitHub and it worked fine. But when I use it here this happens. And BTW how would get to know the format of the audio stream.

          – Jerome Marshall
          Nov 21 '18 at 13:50















          "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

          – Onix
          Nov 21 '18 at 14:03







          "in another sample app from GitHub and it worked fine" - could i have a look on sample? "And BTW how would get to know the format of the audio stream" - Just open stream in any player and see 'video details' (vlc, mediplayer classic)

          – Onix
          Nov 21 '18 at 14:03















          Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

          – Jerome Marshall
          Nov 21 '18 at 14:21





          Here is the sample that I used link. To make it work, I just changed the dataSource to the stream link.

          – Jerome Marshall
          Nov 21 '18 at 14:21













          Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

          – Jerome Marshall
          Nov 21 '18 at 16:09







          Thank you so much @Onix. I gave ExoPlayer a try and it works! Now there are new errors like "getDiskStats failed with result NOT_SUPPORTED and size 0" but it still streams the audio.

          – Jerome Marshall
          Nov 21 '18 at 16:09




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408277%2fmediaplayernative-error-1-2147483648-when-playing-http-progressive-mp3-stre%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          Origin of the phrase “under your belt”?