Android Things video playback on Raspberry Pi
Asked Answered
S

3

9

Has anyone been able to successfully play a video using Android Things on a Raspberry Pi? If so was there anything special you had to do to get it to work? If not does any one know why it isn't working?

I made a simple video player that plays a local video from disk. The app runs fine on a phone but I get an error dialog on the Pi saying "Can't play this video".

One Thing I have already ran into but I think I solved was there are no content providers in Android Things, so instead of using a uri for the video source I gave it a file directly like so.

EDIT: Code edit

VideoView videoPanel;
.
.
.
videoPanel.SetVideoURI(Android.Net.Uri.FromFile(new Java.IO.File("/sdcard/Movies/videoFile.mp4")));
Sungod answered 2/2, 2017 at 16:41 Comment(5)
Where is the file, specifically?Kinetic
Oh sorry the video.src is a string and it is /sdcard/Movies/videofile.mp4Sungod
Do you hold the READ_EXTERNAL_STORAGE permission? Did you reboot your Thing after installing your app (as runtime permissions are not granted until after a reboot, due to current limitations in the preview)?Kinetic
Yes I just double checked in debug mode and the permission is granted, and I rebooted as a sanity check.Sungod
can you also paste the output of adb logcat?Anders
W
2

I was using 0.5.1-devpreview with raspberry pi 3, and tried to use exoplayer to play mp4. Audio works but not video (just black screen). Same result for youtube iframe sdk (black screen with only audio playing).

Wigwag answered 12/10, 2017 at 17:46 Comment(1)
The bug is tracked here: issuetracker.google.com/issues/67738615Wigwag
W
0

I was able to get it to work for my project using setVideoPath instead of SetVideoURI. So your code would be

File file = new Java.IO.File("/sdcard/Movies/videoFile.mp4");
videoPanel.setVideoPath(file.getAbsolutePath());
Weatherproof answered 13/3, 2017 at 22:28 Comment(6)
What Android Things version did you get this to work on? I saw there was an update recently but haven't updated it yet.Sungod
The latest developer preview, version 0.2Weatherproof
The video playback is kind of jumpy since they haven't added any support for OpenGL yet, but it does play at least.Weatherproof
FileNotFound(Permission Denied) permission readExternalPermission is setSignifics
@Jason did you set the READ_EXTERNAL_STORAGE permission in your manifest?Weatherproof
of course set, and reboot it, but i do not know the AT whether or not support the 1920*1080.Significs
B
0

Try adding this

android:hardwareAccelerated="true"

to your activity in the manifest.

Baboon answered 4/1, 2018 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.