JavaFx Drag and Drop a file INTO a program

Here is a simple drag and drop example that just sets the file name and location. Drag files to it and it shows their name and location. Once you know that it should be a completely separate matter to actually play the file. It is primarily taken from Oracle’s documentation: https://docs.oracle.com/javafx/2/drag_drop/jfxpub-drag_drop.htm A minimal implementation needs … Read more

Video player lights out mode in Android using appcompat-v7

I’ve found fitssystemwindows pretty unreliable as well when you want some elements of the view hierarchy to be fullscreen and some elements to be below the status bar or action bar. But I’ve never seen the action bar behind the status bar. Is the Toolbar set as the activity actionbar? Are you using Window.FEATURE_ACTION_BAR_OVERLAY? Anyway, … Read more

Android MediaPlayer throwing “Prepare failed.: status=0x1” on 2.1, works on 2.2

This is my solution: MediaPlayer mediaPlayer = new MediaPlayer(); FileInputStream fis = null; try { File directory = new File(“android.resource://com.example.myapp/raw/”); fis = new FileInputStream(directory); mediaPlayer.setDataSource(fis.getFD()); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepare(); } finally { if (fis != null) { try { fis.close(); } catch (IOException ignore) { } } }

Android – How to tell when MediaPlayer is buffering

Like below (API level ≥ 9): mp.setOnInfoListener(new OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BUFFERING_START: loadingDialog.setVisibility(View.VISIBLE); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: loadingDialog.setVisibility(View.GONE); break; } return false; } }); NOTE : There is a known bug in Android. When playing HLS stream it’s just never calls OnInfoListener or OnBuffering. … Read more

tech