Android custom media controller using vidtry
- by Mathias Lin
I want to use a custom media controller in my Android app and therefore looking at the vidtry code (http://github.com/commonsguy/vidtry), especially Player.java:
The sample works fine as it comes. But I want the sample to play the fixed video automatically on app startup (so I don't want to enter a URL).
I added:
@Override
public void onStart() {
super.onStart();
address.setText("/sdcard/mydata/category/1/video_agkkr6me.mp4");
go.setEnabled(true);
onGo.onClick(go);
}
Strange thing here is that if I run the app, the audio of the video plays but the image doesn't show. Everything else works fine (progress bar, etc.). I can't figure out the difference between the manual click on the go-button and the programmatic one. I looked at the code and didn't see any difference that might occur between manual and programmatic click.
I checked if any elements (esp. surface) might be hidden, but it's not. I even tried a
surface.setVisibility(View.INVISIBLE);
surface.setVisibility(View.VISIBLE);
in case some issue with the redrawing, but no difference.
The video image does show when I manually hit the go button, but just not on start up automatically.