I´m using Delphi XE5 for an app that creates an .avi video file for the user. After successfully creating it (or even just because the user wants to watch the video again) it tries to open it using the app of choice for videos. I understand that android picks the right app for the file type or you can direct it providing the MIME type of the file. So, using intents from Delphi I´m doing
intent:=TJIntent.Create;
intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('file://'videoFile)));
intent.setType(StringToJString('video/avi'));
When I do this, a very basic video player appears (the Running Apps section of Setting show an app called Android Media running) with a play button but does not show the video. But if you use any File Manager or even go through the Gallery and click on the file it plays nicely using the View Video app.
I can´t make my app call View Video directly, not even show a list of video apps for the user to choose it. I tried different MIME types like
intent.setType(StringToJString('video/*'));
and even
intent.setType(StringToJString('*/*'));
Which lets the user choose from any app in its device (nosense but just for testing) so he can choose View Video but even doing that the app shows only a play button and displays no content when pressed.
So, it looks like when called from my app, View Video can´t play the video I created (I do not have it opened or something like that, checked) but when called from other apps it can.
Does anybody know of bugs or limitations when using intents from Delphi XE5 or maybe I´m not doing it right?
intent.settype
in Delphi XE5 was ruining the contents of the data property. Using another setter likeSetDataAndType
works well. Use that one! Not sure if they fixed it in XE6 or XE7.