question

hearstmagazinesitalia avatar image
hearstmagazinesitalia asked

Unable to play video on Kindle Fire HD from within our own app

I have an Android app that uses the MediaPlayer component to play movies. It works fine with all the Android devices, except on the Kindle Fire HD (and probably other Amazon devices as well as I haven't had the chance to test on others). On the Kindle logcat prints the following output: 09-02 09:37:46.971 23979-23979/it.hearst.elledecortest I/VideoControllerView: VideoControllerView 09-02 09:37:46.971 23979-23979/it.hearst.elledecortest I/VideoControllerView: VideoControllerView 09-02 09:37:46.986 23979-23979/it.hearst.elledecortest D/MovieViewController: onViewAttachedToWindow 09-02 09:37:47.010 108-108/? E/ASFDummyExtractor: isASFParserAvailable 09-02 09:37:47.010 108-108/? W/ASFDummyExtractor: ASF parser is not available 09-02 09:37:47.010 108-108/? I/AwesomePlayer: Awsomeplayer is created 09-02 09:37:47.010 108-108/? I/AwesomePlayer: board file present 09-02 09:37:47.010 108-108/? I/AwesomePlayer: cabc present 09-02 09:37:47.010 108-108/? I/AwesomePlayer: setCabc file open ! 09-02 09:37:47.010 108-108/? I/AwesomePlayer: setCabc ret = -22 09-02 09:37:47.010 108-108/? I/AwesomePlayer: cabc present 09-02 09:37:47.010 108-108/? I/AwesomePlayer: setCabc file open ! 09-02 09:37:47.010 108-108/? I/AwesomePlayer: setCabc ret = -22 09-02 09:37:47.010 108-24246/? I/AwesomePlayer: cabc present 09-02 09:37:47.010 108-24246/? I/AwesomePlayer: setCabc file open ! 09-02 09:37:47.010 108-24246/? I/AwesomePlayer: setCabc ret = -22 09-02 09:37:47.010 23979-23989/it.hearst.elledecortest E/MediaPlayer: error (1, -2147483648) 09-02 09:37:47.119 23979-23979/it.hearst.elledecortest E/MediaPlayer: Error (1,-2147483648) 09-02 09:37:47.142 23979-23979/it.hearst.elledecortest E/MediaPlayer: prepareAsync called in state 0 The kind of error seems to mean that the file is not found. The file is actually stored in the private data folder of the app. I tried loading the same file over HTTP from one of our servers and it works like a charm. Could it be a permission problem? I'd like to avoid having to move all of the data of my app from within its folder to a shared folder accessible by anyone if that's the problem. Could anyone give me insights on this issue? Thanks!
fire tablet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Hearstmagazinesitalia, A complete video player example code is given in the below thread. Please go through. It might help. https://forums.developer.amazon.com/forums/thread.jspa?messageID=3426 What did you mean by "private data folder"? I am able to play a mp4 media from sdcard as you can see in the example given in the above thread.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hearstmagazinesitalia avatar image
hearstmagazinesitalia answered
Hello Sujoy, I can play movies from the sdcard as well. But my app doesn't write the content to the sdcard. Instead it's written in the data folder of the app, the one that you get with this call: this.getDir("Other", MODE_PRIVATE); Where "this" is actually an Activity (or any other app Context). Try downloading a media file to that folder and playing it with your video example and it will fail as well..
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
As the Mediaplayer is running on different process, it wont be having permission to access the application data, which is another different process. IF we sign both the mediaplayer and the application with same signature key, then they would run on same process. Usually 3rdparty developer don't get system application signature key. Android provides a way for you to expose even your private data to other applications — with a content provider. A content provider is an optional component that exposes read/write access to your application data, subject to whatever restrictions you want to impose. create a ContentProvider that can serve up your local file and use the provider Uri instead of the Uri to a local file, or create the local file using openFileOutput() and MODE_WORLD_READABLE.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi, I agree with you that VideoView can not play a video media which is stored in private data folder. I am escalating this issue to the concerned team. Thanks for reporting the issue. I will get back to you shortly.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hearstmagazinesitalia avatar image
hearstmagazinesitalia answered
Thanks for acknowledging the issue. I'm looking forward to hearing from you soon.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
I verified that the 3rd Generation Kindle Fires (HDX 8.9", HDX 7" Kindle Fire HD 7" (3rd Gen) ) do not have this issue. Still waiting to hear back from our team for the old devices.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.