Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal music player does not stop playing when file is deleted #1292

Closed
wants to merge 1 commit into from

Conversation

rishabh7m
Copy link
Contributor

@rishabh7m rishabh7m commented Nov 18, 2015

Bug fix for issue #906

edited by @jabarros

  • Create 'internal_music_player' branch from master in android repository @jabarros
  • Merge 'internal_music_player' branch into master
  • Download rishabh7m:master branch changes
  • CR changes @jabarros

@przybylski
Copy link
Member

Hmm there are two scenarios which might be problematic here.

  1. having two audio files A and B, play file A and delete file B remotely and locally, won't that cause to stop playing of file A ?
  2. If external app plays sounds and you delete a file remotely and locally won't that cause to stop playing current sound?

@przybylski
Copy link
Member

Ok, second scenario is invalid because external apps cannot use owncloud MediaService but the first one stays valid.

@rishabh7m
Copy link
Contributor Author

@przybylski Hi, I have fixed the 1st issue with this commit.

}
}
catch (NullPointerException e) {
e.printStackTrace();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of printing stack you should write to log @davivel @tobiasKaminsky any thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second that, should definitely be a log.Call 👍

@rishabh7m
Copy link
Contributor Author

@przybylski @AndyScherzinger I have added log statement in latest commit.

}
}
catch (NullPointerException e) {
Log_OC.e(TAG, "NullPointerException playing " + remotePath, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it more of as "NullPointerException while stopping" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, you are right. I will change that 👍

@przybylski
Copy link
Member

Why do you need Remote path anyway? It can be get from OCFile. Beside if someone wouldn't provide OCFile as a parcelable it is highly likely that remote path also won't be included. IMO this additional argument is redundant.

@rishabh7m
Copy link
Contributor Author

I think if OCFile will be null then OCFile.getRemotePath() will again throw NullPointerException. That's why I included it.

@przybylski
Copy link
Member

Yeah, null OCFile won't even be included because in onConfirmation you are doing the check for null, It is a good practice that you are catching null ptr exception, but if REMOTE_PATH is just there for logging purposes then I don't find it very useful.

@rishabh7m
Copy link
Contributor Author

Will log statement - Log_OC.e(TAG, "NullPointerException while stopping file "); will be fine ?

@przybylski
Copy link
Member

NullPointerException while stopping on OCFile is more descriptive :)

@rishabh7m
Copy link
Contributor Author

Okay, I will fix that :)

@przybylski
Copy link
Member

Great! :) but now REMOTE_PATH is completely redundant :)

@rishabh7m
Copy link
Contributor Author

Sorry, forgot about that. Removing it.

@przybylski
Copy link
Member

Code looks good to me.
Please squash your commits and you have green light from me :)

bug_906_fix_1

Revert "bug_906_fix_1"

This reverts commit 4e23ce3.

Revert "bug_906_fix_1"

This reverts commit 4e23ce3.

revert_906_fix_1

bug_906_fix_log

bug_906_log_fix

bug_906_log_1
@przybylski
Copy link
Member

@tobiasKaminsky IMO this is ready for merge, I belive it should first go to beta right ?

@przybylski
Copy link
Member

@rishabh7m Thank you for your contribution and the will to cooperate with annoying reviewers :)

@przybylski
Copy link
Member

@rishabh7m One more thing, could you maybe provide some meaningful commit message :)

@AndyScherzinger
Copy link
Contributor

Hi @rishabh7m thanks for contributing and great to have you here. One question since you don't have a "collaborator" tag on your postings. Did you already sign the contributor agreement https://owncloud.org/contribute/agreement/ and send it to @karlitschek and @masensio ? Is this a necessary in order to get your pull requests merged to the code base by the core dev team.
And again, thanks for your contribution! Always great to have new people around pushing the app forward!

@rishabh7m
Copy link
Contributor Author

Hi @AndyScherzinger , I have not signed the agreement earlier. There is an employer field in the agreement but I am a student, so will it be fine to leave that empty?

@rishabh7m
Copy link
Contributor Author

@przybylski lol, no one was annoying :)

@AndyScherzinger
Copy link
Contributor

@rishabh7m yeah, just leave it empty then, should be fine 👍

@rishabh7m rishabh7m changed the title bug_906_fix Internal music player does not stop playing when file is deleted Nov 23, 2015
@rishabh7m rishabh7m force-pushed the master branch 2 times, most recently from 5562783 to 033e297 Compare November 28, 2015 15:53
@LukeOwlclaw LukeOwlclaw mentioned this pull request Mar 18, 2016
Intent i = new Intent(getActivity(), MediaService.class);
i.putExtra(MediaService.EXTRA_FILE, ocFile);
i.setAction(MediaService.ACTION_STOP_FILE);
getActivity().startService(i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you set this behaviour also for a local remove, since it makes sense that if you want to remove the file locally, you don't want to keep it in the buffer of the media service.

P.D: The local remove listener is currently set in the negative button (which listener mehotd is onCancel). Extract to a new method to reuse the MediaService call.

@davivel davivel added this to the backlog milestone Jul 14, 2016
@davivel
Copy link
Contributor

davivel commented Jul 14, 2016

Hi, @rishabh7m. Sorry for joining so late, and thanks for your patience.

This PR seems really fine, thank you very much.

I think @malkomich is right, makes sense stopping the reproduction also when the deletion is only local (method onCancel in RemoveFileDialogFragment. Could you create a private method with the code stoping the media service and call when any of the deletions is confirmed?

I will help you then with the rebase on master.

@jabarros
Copy link
Contributor

Hi everybody,
We have just opened a new PR, #1814 in order to be able to do the rebase and apply the CR changes proposed, so let me close this one.
If you want to do any comment, please, add it into the new PR thread.

@jabarros jabarros closed this Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants