My application is an Air application that uses the Starling engine and plays streaming video.
Since Starling does not support video playback, I decided to go my own way and wrote ANE to play the video.
I start a new action with VideoView to display video, and on new Androids (tested APIs 19 and 18), when MediaController.show () is called, the application crashes. I don't have a useful stack trace, as the Android bit compiles as a native extension. On older devices (tested at API level 15 and 9) MediaController works very well.
I also tried replacing the MediaController with Play / Pause ImageView, and again, it works fine on older devices, while on newer devices it plays once with the image shown, a second time without showing the image (the object is still created and a child layout element), and the third time the application is completely disabled.
On new devices, if I remove ImageView, the application will not work, and also if I leave the attached ImageView and do not call requestWindowFeature (Window.FEATURE_NO_TITLE).
This is the code that works on older devices (using MediaController):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT <= 15)
requestWindowFeature(Window.FEATURE_NO_TITLE);
int resourceId = PlayVideoFunction.ctx.getResourceId("layout.main");
setContentView(resourceId);
Log.d("NativeExtension", "OnCreate " + this.toString());
Log.d("NativeExtension", "On Resume");
String url = getIntent().getStringExtra("url");
Log.d("NativeExtension", "url " + url);
int videoViewId = PlayVideoFunction.ctx.getResourceId("id.videoView");
videoView = (VideoView) findViewById(videoViewId);
videoView.setVideoURI(Uri.parse(url));
videoView.setOnCompletionListener(this);
videoView.setOnErrorListener(this);
videoView.setOnPreparedListener(this);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
mediaController.setMediaPlayer(videoView);
videoView.setMediaController(mediaController);
}
Has anyone had similar issues related to native extensions? I guess it should do something with the Window object in Android and Air / Starling. Also, I'm lost.
: ( )
http://pastebin.com/tnuEgWFA