-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Media streaming with NC14 endpoint #2524
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
Conversation
|
For such PR that need a library PR, I guess the best is to reference the branch directly, or? --> I am not sure how to handle this best… |
| // Parse the response | ||
| JSONObject respJSON = new JSONObject(response); | ||
| String url = (String) respJSON.getJSONObject(NODE_OCS).getJSONObject(NODE_DATA).get(NODE_URL); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't you just use getString instead of get()+cast ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed 👍
|
Shouldn't stream just be the default instead of having a dedicated stream menu button? What does "stream" means to say, my grandma? |
| mFileActivity.startActivity(Intent.createChooser(openFileWithIntent, | ||
| mFileActivity.getString(R.string.stream))); | ||
| } | ||
| }).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: What about using a lambda and putting the whole run() code into a separate method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup please.
|
|
||
| new LoadStreamUrl(this, client).execute(getFile().getLocalId()); | ||
| } catch (Exception e) { | ||
| Log_OC.e(TAG, "Loading stream url not possible: " + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we also add the exception itself to the log statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| R.string.stream_not_possible_message, R.drawable.file_movie); | ||
| } | ||
| } else { | ||
| Log_OC.e(TAG, "Error streaming file: no previewMediaFragment!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: shouldn't we also add the exception itself to the log statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is no exception.
It happens when fragment is null.
|
Just some minor code comments
I agree it should be the default cation when clicking on an item (that can be streamed in general) and I remember that this is also what Tobias told me :) |
|
It is: if you click on audio/video it will try to stream the file with our internal player. If our internal player fails, it says "Please download media instead or use external app.". |
| return mMediaController; | ||
| } | ||
|
|
||
| private static class LoadStreamUrl extends AsyncTask<String, Void, String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no other way but an AsyncTask? I thought we got rid of this ages ago :P
|
To further clarify my comment on AsyncTasks: TobiasK: as for media streaming: I'd appreciate if we'd move away from asynctasks, especially for new code |
|
For up/downloading I agree to use services or jobs/eventbus. So I would go for this:
|
|
Ah. Service or Job can be ran right away too, but I just noticed that it's a simple fetching of url, not of an actual image. Regardless, shouldn't we do it differently in a way that survives rotations etc instead of having to worry about these things? |
|
Would be great to get this in. NC14 will go into freeze soon. So having a client that uses it will allow us to properly test it. |
11c45f0 to
88fd930
Compare
|
Rebased & ready for final review |
Codecov Report
@@ Coverage Diff @@
## master #2524 +/- ##
=========================================
+ Coverage 6.4% 6.42% +0.02%
=========================================
Files 294 297 +3
Lines 29450 29709 +259
Branches 4252 4284 +32
=========================================
+ Hits 1885 1910 +25
- Misses 27278 27515 +237
+ Partials 287 284 -3
|
|
@tobiasKaminsky what about @mario's latest comment: #2524 (comment) ? |
|
Both loading url task are done when playing media, so I think it is fine. Beside that, there is somewhere an issue, where I started a discussion how to do long running background tasks, that maybe even survive activity rotate/open/close. --> I would keep it this way and later replace it with a potential better solution. |
Fine with me |
|
E.g. UserInfoActivity is the same: Of course, doing the same is not pushing the code to a better state, but I think we should find a better and generic approach first and then change it. |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
46a3694 to
8869e4c
Compare
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Lint
FindBugs (new)
FindBugs (master)
|
Needs:
Fixes: #379
This enables video/audio streaming without exposing any credentials.
Test cases:
NC14
NC13
Signed-off-by: tobiasKaminsky tobias@kaminsky.me