Android ExternalPlayer::ExecuteAppAndroid() is not a good design
#1
I'm working on a Xiaomi Box to make XBMC to use external players to output 1080p quality video.

I looked into the source code of these branches:
github.com/xbmc/xbmc 12.2
github.com/xbmcandroid/xbmc 12.2
github.com/xbmc/xbmc master

I found the "github.com/xbmcandroid/xbmc" add code to directly call Android Activity by adding a function ExternalPlayer::ExecuteAppAndroid() and it has been merged to the "github.com/xbmc/xbmc master".

I think this is not a good design.

First, The function of ExternalPlayer::ExecuteAppAndroid() is hard-coded:
{
CXBMCApp::StartActivity(strSwitches, "android.intent.action.VIEW", "video/*", strPath);
}
For an Activity's Intent not "android.intent.action.VIEW", this method will not work.
For an Activity which is not the default activity of the application, this method will not work.

Second, the implementation of CXBMCApp::StartActivity() is inflexible and incomplete.

Acturely, the Linux system() can start an Android activity like this:
Quote: system("am start -a android.intent.action.VIEW -n com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ActivityScreen$WebDelegate -d {0}");
Here "am" is an android system application and has many parameters.

So we need only change the part of playercorefactory.xml like this:
Quote: <!-- MXPlayer Free definition -->
<player name="MXPlayerFree" type="ExternalPlayer" audio="false" video="true">
<!-- Android intent -->
<filename>am</filename>
<filename>start -a android.intent.action.VIEW -n com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ActivityScreen$WebDelegate -d {0}</filename>
<!-- Hide XBMC -->
<hidexbmc>true</hidexbmc>
<!-- After 2 minutes bump the play count of the item in XBMC -->
<playcountminimumtime>120</playcountminimumtime>
</player>
Comparing to the part of the playercorefactory.xml in "github.com/xbmcandroid/xbmc 12.2":
Quote: <!-- MXPlayer Free definition -->
<player name="MXPlayerFree" type="ExternalPlayer" audio="false" video="true">
<!-- Android intent -->
<filename>com.mxtech.videoplayer.ad</filename>
<!-- Hide XBMC -->
<hidexbmc>true</hidexbmc>
<!-- After 2 minutes bump the play count of the item in XBMC -->
<playcountminimumtime>120</playcountminimumtime>
</player>
Reply
#2
Nak, we will not be using a brute force 'system' call to start an android app. There are a number of reason this could fail, the foremost is permissions.

One could expand the playercorefactory.xml api to include the Activity's Intent required to start the external app. That would resolve your 'ExternalPlayer::ExecuteAppAndroid() is hard-coded' issue. patches/PR is welcome.

If you think CXBMCApp::StartActivity is inflexible and incomplete, then submit patches/PR to improve it.
Reply

Logout Mark Read Team Forum Stats Members Help
ExternalPlayer::ExecuteAppAndroid() is not a good design0