Exception when starting external player
#1
Hello,

When trying to start my own player, I encountered the following exception:

E/AndroidRuntime( 2365): FATAL EXCEPTION: Thread-122
E/AndroidRuntime( 2365): java.lang.NullPointerException: pattern == null
E/AndroidRuntime( 2365): at java.util.regex.Pattern.compile(Pattern.java:388)
....(Saving the space)...
E/AndroidRuntime( 2365): at dalvik.system.NativeStart.run(Native Method)
W/ActivityManager( 1402): Force finishing activity org.xbmc.xbmc/.Main
D/dalvikvm( 1402): GC_FOR_ALLOC freed 691K, 30% free 11998K/17095K, paused 134ms

The root cause of this is that the function that starts the external player does not set the mime type for the URI I'm playing. Here is a diff of my fix:

diff --git a/xbmc/android/activity/XBMCApp.cpp b/xbmc/android/activity/XBMCApp.cpp
index 9f8e8c1..428f3c8 100644
--- a/xbmc/android/activity/XBMCApp.cpp
+++ b/xbmc/android/activity/XBMCApp.cpp
@@ -398,17 +398,23 @@ bool CXBMCApp::HasLaunchIntent(const string &package)
// Note intent, dataType, dataURI all default to ""
bool CXBMCApp::StartActivity(const string &package, const string &intent, const string &dataType, const string &dataURI)
{
+
+ android_printf("StartActivity: package=%s intent=%s dataType=%s dataURI=%s",package.c_str(), intent.c_str(), dataType.c_str(), dataURI.c_str());
+
CJNIIntent newIntent = GetPackageManager().getLaunchIntentForPackage(package);
if (!newIntent)
return false;

+ CJNIURI jniURI= CJNIURI::parse(dataURI);
+
if (!dataURI.empty())
- newIntent.setData(dataURI);
+ newIntent.setDataAndType(jniURI,dataType);

if (!intent.empty())
newIntent.setAction(intent);

- startActivity(newIntent);
+ startActivity(newIntent);
+
return true;
}

With Best Regards,
Arik Halperin
Reply
#2
Could you do this as a pull request to http://github.com/xbmc/xbmc please?
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply

Logout Mark Read Team Forum Stats Members Help
Exception when starting external player0