- 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 yet
+ String url;
+ try {
+ url = AccountUtils.constructFullURLForAccount(this, getAccount()) + file.getRemotePath();
+ mVideoPlayer.setVideoURI(Uri.parse(url));
+ } catch (AccountNotFoundException e) {
+ onError(null, MediaService.OC_MEDIA_ERROR, R.string.media_err_no_account);
+ }
+ }
+
+ // create and prepare control panel for the user
+ mMediaController = new MediaController(this);
+ mMediaController.setMediaPlayer(mVideoPlayer);
+ mMediaController.setAnchorView(mVideoPlayer);
+ mVideoPlayer.setMediaController(mMediaController);
+