• 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 7
Android XBMC with Diceplayer demo
#46
(2012-08-24, 04:43)Ned Scott Wrote: Montellese, is there anything that the devs of the external players could add that would help in getting data back to XBMC? Write something to a file or communicate via one of the XBMC APIs?

No, it does not work that way. As I've mentioned before, trying to supplement hardware video decode by using external players is a distraction to the development of our own hardware decode ability. We just need to put nose to the grindstone and work it out. While it would be nice to have some help in that area, it does not look like anyone outside will contribute so we just have to continue our own path.
Reply
#47
(2012-08-20, 11:33)Montellese Wrote: My patch is very basic. I'm not sure whether it's better to use the existing external player implementation and extend it to support android apps or whether it should be its own player. The problem is there is no support for getting data from the android player to xbmc.

If you give me a API for sending data to XBMC, I will make my player to work with your API.
Reply
#48
@juami :

Look at AMLPlayer and how a possible support for your player can look like :

https://github.com/xbmc/xbmc/tree/master.../amlplayer

Cheers

gimli

P.S.: as davilla stated. Help on our internal HW decoding is more then welcome.
Reply
#49
This maybe a stupid question, but what data would be needed from the external player to XBMC? When the movie is finished the player would exit to reveal XBMC behind it. This is the behavior when a movie is selected in a file manager and played by a external player.
Reply
#50
(2012-08-24, 04:43)Ned Scott Wrote: Montellese, is there anything that the devs of the external players could add that would help in getting data back to XBMC? Write something to a file or communicate via one of the XBMC APIs?
I would imagine that using WebSocket over JSON-RPC API could be an acceptable approach to achieve a communication channel between external players and XBMC?

https://github.com/xbmc/xbmc/pull/511

http://wiki.xbmc.org/index.php?title=JSO...#WebSocket
Quote: WebSocket

The WebSocket transport has been added since Version 5 and can be used by third-party applications runnong on the same machine as XBMC or on a different machine which can access the machine running XBMC using the Websocket protocol. The supported versions are 8 (draft hybi-10) and 13 (RFC 6455). Because this transport allows applications outside XBMC to control XBMC it has to be manually enabled (see Enabling JSON-RPC) by the user. Once enabled, third-party applications can access XBMC's JSON-RPC API by sending a WebSocket protocol handshake to the following URI

ws://<your-ip>:<configured tcp port>/jsonrpc

It is important to send the handshake on the port of XBMC's TCP server (by default 9090, but this port can be configured in the advanced settings file). After having successfully finished the handshake third-party applications can send WebSocket protocl messages over that connection.

I understand that Team-XBMC would prefer not to have to use an external-player for playback of local unencrypted data files just to achieve hardware accelerated video playback on Android, but it could be a way to semi-integrate online DRM sources such as Netflix and playback of encrypted video formats such as Blu-ray Disc media?

For example use an addon in XBMC for indexing your Netflix library via their API, then have that addon launch the Netflix for Android app when you select to play a specific movie.

Same way have XBMC launch an separate paid and legally licensed Blu-ray Disc player app on Android when you insert a Blu-ray Disc media in a USB Blu-ray Disc reader connected to your Pivos XIOS DS box, or future boxes with integrated Blu-ray Disc reader.

Might however be very difficult to get companies like Netflix to add WebSocket support to their Android app so that it can have bi-directional / full-duplex communications with XBMC.
Reply
#51
(2012-08-24, 10:54)Nu7s Wrote: This maybe a stupid question, but what data would be needed from the external player to XBMC? When the movie is finished the player would exit to reveal XBMC behind it. This is the behavior when a movie is selected in a file manager and played by a external player.

watched tag update, auto bookmark tag for resume, etc.

EDIT: Oh boy, I just updated diceplayer and the pop up player is flawless on my touchpad. I had used that feature before in Mirage Beta, but it only allowed you to attach it to one of the corners and it always crashed when trying to go back. With dice, you can move it around or resize it as you wish and it is totally smooth even while playing a 1080p video. Amazing!!
Reply
#52
for those interested in launching MX Player from xbmc, the developer has nicely added some comments on his forum about why XBMC is unable to launch MX Player - something to do with the XBMC patch calling the wrong method.


Quote:I tested latest patch of XBMC-android (xbmckor-armeabi-v7a-20120821.apk).
This version launches external player with incorrect Intent parameter.

This is what I got from logcat log.

09-01 03:48:37.580: I/ActivityManager(192): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] dat=/mnt/sdcard/h264_aac.mp4 flg=0x10000000 pkg=com.mxtech.videoplayer.ad cmp=com.mxtech.videoplayer.ad/.ActivityVideoList} from pid 4510


As you can see its act (Action) parameter is android.intent.action.MAIN. android.intent.action.MAIN is not supposed to be used in this way. Instead, android.intent.action.VIEW should be passed. and cat (Category) parameter is not required.

This is definition of android.intent.action.MAIN action from android document.
(http://developer.android.com/reference/a...CTION_MAIN)
Activity Action: Start as a main entry point, does not expect to receive data.

Input: nothing

Output: nothing
Reply
#53
Great, I'm happy posting there had some result.

I have no idea how to use github to post a commit? to the patch? Can somebody else integrate the above change into the github repository?

And has anyone used a working version of XMBC for android on a Mele A1000/2000? All I get is a black screen with all versions I have tried so far.
Reply
#54
Hi!
I recently compiled a xbmc version that works with MX Player (I think it will work with diceplayer too). Big Grin

I used the ticket from this post and I only changed the code in "XBMCApp.cpp", the rest is the same.

You can apply this patch: Ticket #13267: diff.android.patch, but replace "StartActivityWithExtra" for the one I attached.

Code:
// External Player
bool CXBMCApp::StartActivityWithExtra(const string &package,const string &path)
{
  if (!m_activity || !package.size())
    return false;

  jthrowable exc;
  JNIEnv *env = NULL;
  AttachCurrentThread(&env);
  jobject oActivity = m_activity->clazz;
  jclass cActivity = env->GetObjectClass(oActivity);
  
  
  
// Intent oIntent = new Intent(Intent.ACTION_VIEW);
jclass cIntent = env->FindClass("android/content/Intent");
jmethodID midIntentCtor = env->GetMethodID(cIntent, "<init>", "(Ljava/lang/String;)V");
jstring sIntentView = env->NewStringUTF("android.intent.action.VIEW"); // Intent.ACTION_VIEW
jobject oIntent = env->NewObject(cIntent, midIntentCtor, sIntentView);
env->DeleteLocalRef(sIntentView);

// Uri oUri = Uri.parse(sPath);
jclass cUri = env->FindClass("android/net/Uri");
jmethodID midUriParse = env->GetStaticMethodID(cUri, "parse", "(Ljava/lang/String;)Landroid/net/Uri;");
jstring sPath = env->NewStringUTF(path.c_str());
jobject oUri = env->CallStaticObjectMethod(cUri, midUriParse, sPath);
env->DeleteLocalRef(sPath);
env->DeleteLocalRef(cUri);

// oIntent.setDataAndType(oUri, "video/*");
jmethodID midIntentSetDataAndType = env->GetMethodID(cIntent, "setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;");
jstring sMimeType = NULL;
sMimeType = env->NewStringUTF("video/*");
oIntent = env->CallObjectMethod(oIntent, midIntentSetDataAndType, oUri, sMimeType);

// oIntent.setPackage(sPackage);
jstring sPackage = env->NewStringUTF(package.c_str());
jmethodID mSetPackage = env->GetMethodID(cIntent, "setPackage", "(Ljava/lang/String;)Landroid/content/Intent;");
oIntent = env->CallObjectMethod(oIntent, mSetPackage, sPackage);

env->DeleteLocalRef(sMimeType);
env->DeleteLocalRef(oUri);
env->DeleteLocalRef(cIntent);
env->DeleteLocalRef(sPackage);
  

// startActivity(oIntent);
jmethodID mStartActivity = env->GetMethodID(cActivity, "startActivity", "(Landroid/content/Intent;)V");
env->CallVoidMethod(oActivity, mStartActivity, oIntent);
env->DeleteLocalRef(cActivity);
env->DeleteLocalRef(oIntent);

exc = env->ExceptionOccurred();
if (exc)
{
  CLog::Log(LOGERROR, "CXBMCApp::StartActivity Failed to load %s. Exception follows:", package.c_str());
  env->ExceptionDescribe();
  env->ExceptionClear();
  DetachCurrentThread();
  return false;
}

DetachCurrentThread();
return true;
}
// End External Player

The issue with the original code was the method "getLaunchIntentForPackage". This find the first intent action for the package. The MX Player have both, MAIN and VIEW, but "getLaunchIntentForPackage" only finds the MAIN intent, and for this reason it doesn't work.

Remember to update the "playercorefactory.xml", use:
com.mxtech.videoplayer.pro - Pro Edition
com.mxtech.videoplayer.ad - Free Edition.

I tested it in a Mele A1000 and works pretty well.
You can download the apk from here: XBMC Apk
I attached in the link the modified files: "XBMCApp.cpp" & "XBMCApp.h".

NOTE: I made this with code from Montellese and juami, it ISN'T all my work. Please give credit to them.
Please tell me if you need to make a patch or a diff file.
Reply
#55
(2012-09-03, 01:55)inRivalz Wrote: Hi!
I recently compiled a xbmc version that works with MX Player (I think it will work with diceplayer too). Big Grin

I used the ticket from this post and I only changed the code in "XBMCApp.cpp", the rest is the same.

You can apply this patch: Ticket #13267: diff.android.patch, but replace "StartActivityWithExtra" for the one I attached.

Code:
// External Player
bool CXBMCApp::StartActivityWithExtra(const string &package,const string &path)
{
  if (!m_activity || !package.size())
    return false;

  jthrowable exc;
  JNIEnv *env = NULL;
  AttachCurrentThread(&env);
  jobject oActivity = m_activity->clazz;
  jclass cActivity = env->GetObjectClass(oActivity);
  
  
  
// Intent oIntent = new Intent(Intent.ACTION_VIEW);
jclass cIntent = env->FindClass("android/content/Intent");
jmethodID midIntentCtor = env->GetMethodID(cIntent, "<init>", "(Ljava/lang/String;)V");
jstring sIntentView = env->NewStringUTF("android.intent.action.VIEW"); // Intent.ACTION_VIEW
jobject oIntent = env->NewObject(cIntent, midIntentCtor, sIntentView);
env->DeleteLocalRef(sIntentView);

// Uri oUri = Uri.parse(sPath);
jclass cUri = env->FindClass("android/net/Uri");
jmethodID midUriParse = env->GetStaticMethodID(cUri, "parse", "(Ljava/lang/String;)Landroid/net/Uri;");
jstring sPath = env->NewStringUTF(path.c_str());
jobject oUri = env->CallStaticObjectMethod(cUri, midUriParse, sPath);
env->DeleteLocalRef(sPath);
env->DeleteLocalRef(cUri);

// oIntent.setDataAndType(oUri, "video/*");
jmethodID midIntentSetDataAndType = env->GetMethodID(cIntent, "setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;");
jstring sMimeType = NULL;
sMimeType = env->NewStringUTF("video/*");
oIntent = env->CallObjectMethod(oIntent, midIntentSetDataAndType, oUri, sMimeType);

// oIntent.setPackage(sPackage);
jstring sPackage = env->NewStringUTF(package.c_str());
jmethodID mSetPackage = env->GetMethodID(cIntent, "setPackage", "(Ljava/lang/String;)Landroid/content/Intent;");
oIntent = env->CallObjectMethod(oIntent, mSetPackage, sPackage);

env->DeleteLocalRef(sMimeType);
env->DeleteLocalRef(oUri);
env->DeleteLocalRef(cIntent);
env->DeleteLocalRef(sPackage);
  

// startActivity(oIntent);
jmethodID mStartActivity = env->GetMethodID(cActivity, "startActivity", "(Landroid/content/Intent;)V");
env->CallVoidMethod(oActivity, mStartActivity, oIntent);
env->DeleteLocalRef(cActivity);
env->DeleteLocalRef(oIntent);

exc = env->ExceptionOccurred();
if (exc)
{
  CLog::Log(LOGERROR, "CXBMCApp::StartActivity Failed to load %s. Exception follows:", package.c_str());
  env->ExceptionDescribe();
  env->ExceptionClear();
  DetachCurrentThread();
  return false;
}

DetachCurrentThread();
return true;
}
// End External Player

The issue with the original code was the method "getLaunchIntentForPackage". This find the first intent action for the package. The MX Player have both, MAIN and VIEW, but "getLaunchIntentForPackage" only finds the MAIN intent, and for this reason it doesn't work.

Remember to update the "playercorefactory.xml", use:
com.mxtech.videoplayer.pro - Pro Edition
com.mxtech.videoplayer.ad - Free Edition.

I tested it in a Mele A1000 and works pretty well.
You can download the apk from here: XBMC Apk
I attached in the link the modified files: "XBMCApp.cpp" & "XBMCApp.h".

NOTE: I made this with code from Montellese and juami, it ISN'T all my work. Please give credit to them.
Please tell me if you need to make a patch or a diff file.
Hello
I test on Samsung Galaxy Note N7000 and N101 (RK-3066) not work.
you can fix .
Reply
#56
This goes in a complete wrong direction.
Reply
#57
(2012-09-03, 09:10)gimli Wrote: This goes in a complete wrong direction.

Isn't this thread about launching an external player (Dice/Mx/...) from within XBMC?
Reply
#58
I think gimli's complain is about loosing comfort and features of XBMC by running external players.

On the other hand, there are a lot of XBMC fans with A10 devices around here and nobody (maybe except of gimli Smile ) knows if there will ever be a native solution for Allwinner (and also other) devices.
Reply
#59
Just to make things clear, if XBMC's internal player would support HW accel on my device, there is not a hair on my head that would think about using an external player... Wink
Reply
#60
Hmm, OK if you want to use XBMC as an "nice" filebrowser of your media using metadata, you might be better of usinig Mizuu.tv

It is basically the same!

What about sub titles who are next to your video's on a NAS? Is MXPlayer and/or Diceplayer able to read them if the file is not really local? I guess you also need to fool XBMC/External player by mounting the shared folder into a local directory (smbmount apk)

I have mixed feelings about the whole external player approach Wink
Reply
  • 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 7

Logout Mark Read Team Forum Stats Members Help
XBMC with Diceplayer demo2