- public boolean onTouchEvent (MotionEvent ev){
- /*if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (mMediaController.isShowing()) {
- mMediaController.hide();
+ protected void onAccountSet(boolean stateWasRecovered) {
+ if (getAccount() != null) {
+ OCFile file = getFile();
+ /// Validate handled file (first image to preview)
+ if (file == null) {
+ throw new IllegalStateException("Instanced with a NULL OCFile");
+ }
+ if (!file.isVideo()) {
+ throw new IllegalArgumentException("Non-video file passed as argument");
+ }
+ mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
+ file = mStorageManager.getFileById(file.getFileId());
+ if (file != null) {
+ if (file.isDown()) {
+ mVideoPlayer.setVideoPath(file.getStoragePath());
+
+ } else {
+ // not working now
+ String url = AccountUtils.constructFullURLForAccount(this, getAccount()) + file.getRemotePath();
+ mVideoPlayer.setVideoURI(Uri.parse(url));
+ }
+
+ // create and prepare control panel for the user
+ mMediaController = new MediaController(this);
+ mMediaController.setMediaPlayer(mVideoPlayer);
+ mMediaController.setAnchorView(mVideoPlayer);
+ mVideoPlayer.setMediaController(mMediaController);
+