Software⏱️ 3 min read📅 2026-06-04

How to Fix: Media Player called in state 0, error (-38,0)

The error (-38,0) indicates a problem with the media player's state. This could be due to a corrupted or invalid URL, incorrect settings, or a missing library. Check the URL and ensure it is correct, then try setting the data source again.

Quick Answer: Verify the URL and try setting the data source again.

The 'Media Player in state 0, error (-38,0)' issue occurs when you're trying to stream an internet radio station using the MediaPlayer class. This error affects Android developers who are building media player applications.

This frustrating error can be caused by various factors, including incorrect URL formatting, insufficient permissions, or issues with the MediaPlayer class itself.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the MediaPlayer class requires specific permissions to access internet resources. If these permissions are not granted correctly, the media player will enter an invalid state, resulting in the '-38,0' error code.
  • Another possible cause of this issue is incorrect URL formatting. Ensure that the URL is properly formatted and contains all necessary parameters for successful streaming.

🛠️ Step-by-Step Verified Fixes

Granting Required Permissions

  1. Step 1: Step 1: Open your app's AndroidManifest.xml file and add the necessary permissions to access internet resources. Specifically, you need to request the 'android.permission.INTERNET' permission.
  2. Step 2: Step 2: Ensure that the 'android.permission.INTERNET' permission is declared in the element within the AndroidManifest.xml file.
  3. Step 3: Step 3: If your app targets API level 23 or higher, you may need to request additional permissions using the 'requestPermissions' method.

Correcting URL Formatting

  1. Step 1: Step 1: Verify that the URL is properly formatted and contains all necessary parameters for successful streaming. Check the documentation of the internet radio station you're trying to stream from.
  2. Step 2: Step 2: If the URL is correctly formatted, try using a different URL or checking if there are any issues with your network connection.

💡 Conclusion

By following these steps and ensuring that the required permissions are granted correctly, you should be able to resolve the 'Media Player in state 0, error (-38,0)' issue. If you continue to experience problems, consider seeking further assistance or consulting the documentation for the MediaPlayer class.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions