Repository navigation
Video streaming - #1907
Video streaming#1907
Conversation
|
@davigonz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @davivel, @stoyicker and @jabarros to be potential reviewers. |
e85fd26 to
77f4c1c
Compare
77f4c1c to
50c43e1
Compare
5cad77f to
cb6c74e
Compare
| <activity android:name=".ui.activity.PrivacyPolicyActivity"></activity> | ||
| <activity android:name=".ui.preview.PreviewVideoActivity" | ||
| android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" | ||
| android:launchMode="singleTop" |
|
|
||
| configurations.all { | ||
| resolutionStrategy { | ||
| force "com.android.support:support-annotations:${supportLibraryVersion}" |
There was a problem hiding this comment.
To fix this conflict which has been triggered while adding the Exoplayer library dependency:
Conflict with dependency 'com.android.support:support-annotations' in project 'android'. Resolved versions for app (25.0.1) and test app (24.2.1) differ.
|
|
||
| <VideoView | ||
| android:id="@+id/video_preview" | ||
| <com.google.android.exoplayer2.ui.SimpleExoPlayerView android:id="@+id/video_preview_fragment" |
There was a problem hiding this comment.
Why the change in the name from 'video_preview' to 'video_preview_fragment'? SimpleExoPlayerView is not a Fragment
There was a problem hiding this comment.
Mmmm, this file is not being used anymore. Both the PreviewVideoFragment and PreviewActivity use res/layout/video_player.xml. Please, remove one of them
| app:controller_layout_id="@layout/custom_playback_control"/> | ||
|
|
||
| <!-- last to draw, will be top in Z axis --> | ||
| <include layout="@layout/top_progress_bar"/> |
There was a problem hiding this comment.
Is this progress bar really needed here?
There was a problem hiding this comment.
Yes, it is used when the certificate is untrusted and the video file starts to download automatically
| <string name="privacy_policy_error">"An error has occurred: "</string> | ||
| <string name="service_unavailable">Server is unavailable</string> | ||
|
|
||
| <string name="uploads_view_upload_status_failed_storage_not_available_error">Storage not available</string> |
There was a problem hiding this comment.
This string is not used. Please, remove it. Probably it's inherited from other branch where it was later renamed or deleted, before merging into master.
|
|
||
|
|
||
| /** | ||
| * Created by davidgonzalez on 22/2/17. |
| final GetCredentialsTask task = new GetCredentialsTask(); | ||
| task.execute(account); | ||
|
|
||
| OwnCloudCredentials credentials = task.get(); |
There was a problem hiding this comment.
This will not work fine.
You run a task as an AsyncTask because you want it occurs in another thread, because the task is too long and don't want the current thread (probably the main thread) uses all that time in this.
But then you call task.get(), and that waits in the current thread until the task is finished.
So, in the end, this works just exactly as if you do not use an AsyncTask, but with more code. Not a good deal.
There was a problem hiding this comment.
Updated, using the AsyncTask for preparing the video player instead of only using it for getting the credentials.
| protected OwnCloudCredentials doInBackground(Object... params) { | ||
| Object account = params[0]; | ||
| try { | ||
| OwnCloudCredentials ocCredentials = AccountUtils.getCredentialsForAccount(MainApp.getAppContext(), (Account) account); |
| * | ||
| * {@inheritDoc} | ||
| */ | ||
| private static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter(); |
There was a problem hiding this comment.
Not needed, changed
| public void onResume() { | ||
| super.onResume(); | ||
| Log_OC.v(TAG, "onResume"); | ||
| if ((Util.SDK_INT <= 23 || player == null)) { |
There was a problem hiding this comment.
Why the difference depending on API level? Just curious.
There was a problem hiding this comment.
I'm not sure about this, I've gotten this part from the Exoplayer demo example. At first glance, it has no sense but I would have to check it.
There was a problem hiding this comment.
I've definitely deleted it, not needed.
5714860 to
42d8e70
Compare
| @@ -0,0 +1,33 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
Maybe we should rename this as preview_video_fragment, for consistency with the other layouts.
There was a problem hiding this comment.
Renaming it as preview_video_fragment could be confusing because this layout is currently being used in the preview video fragment and also in the full screen mode, when any fragment is shown.
There was a problem hiding this comment.
Yes, I know. OK, not really important.
| <string name="streaming_file_not_found_error">This video file is no longer available in the server</string> | ||
| <string name="previewing_video_common_error">This video cannot be reproduced</string> | ||
|
|
||
| <string name="previewing_video_not_supported">Video previewing is not supported in your Android version. File download will start automatically and you will be able to open it with an external player</string> |
There was a problem hiding this comment.
This error message was the same in the previous review? Seems too long. Do you think that explaining that file download will be done is needed? Should be quite obvious.
There was a problem hiding this comment.
This error message is not the same as the previous review, the one you mean is just above it (previewing_video_common_error). This (previewing_video_not_supported) is particularly shown while using ICE CREAM SANDWICH devices.
There was a problem hiding this comment.
OK, thought I would use "Video streaming is not supported in your Android version"
Moreover, I would not even show an error. Just would download the file. That's what already happens in the released app, the expectation does not have to change.
There was a problem hiding this comment.
Also, you considered ICE CREAM SANDWICH edge case in PreviewMediaFragment, but not in PreviewVideoActivity.
There was a problem hiding this comment.
Yes, I prefer your error message but I don't agree with you about not showing the error message. It's the current behaviour in the released app but we should give feedback to the user as much as possible. If the user see that the download starts automatically, he will wonder why.
ICE CREAM SANDWICH is only considered in PreviewVideoFragment because there is no way to go into full screen mode if the video player is not still prepared (full screen button is hidden till the video player is prepared)
| public PrepareVideoPlayerAsyncTask(Activity activity, OCFile file, Account account, | ||
| Handler mainHandler) { | ||
| mContext = activity.getApplicationContext(); | ||
| mListener = new WeakReference<>((OnPrepareVideoPlayerTaskListener)activity); |
There was a problem hiding this comment.
I'd rather use OnPrepareVideoPlayerTaskListener as the parameter type, that would prevent the need of a casting.
There was a problem hiding this comment.
Casting from activity to OnPrepareVideoPlayerTaskListener would be needed anyway even though the mListener be OnPrepareVideoPlayerTaskListener.
There was a problem hiding this comment.
Better in the client of the call than in the implementation. In this method, you are requesting your future callers for a parameter with a concrete interface, but you never use it according to that interface - you use the object with another interface totally unrelated. A client not knowing the method implementation could pass just any Activity, not implementing OnPrepareVideoPlayerTaskListener , and get the task fail. What the method really needs is an OnPrepareVideoPlayerTaskListener that is what should request.
There was a problem hiding this comment.
Yes, you're right, but I've followed the same implementation as AuthenticatorAsyncTask, which constructor is doing the casting in the same way.
There was a problem hiding this comment.
Yes, but AuthenticatorAsyncTask is using the Activity as an Activity:
mContext = activity.getApplicationContext()
This other AsyncTask is not doing so.
There was a problem hiding this comment.
WT... this AsyncTask is doing so... Sorry, I don't know how I missed that.
In any case, would be wiser to include two different parameters in the interface, one for the Activity and one for the listener. If the client passes a single object for them is up to it.
There was a problem hiding this comment.
This AsyncTask is doing so actually, I've changed the casting to the callers anyway
|
|
||
| try { | ||
|
|
||
| OwnCloudCredentials credentials = AccountUtils.getCredentialsForAccount(MainApp.getAppContext(), account); |
|
@davigonz , just a couple of minors, overall is OK. |
8208bc9 to
4e48313
Compare
|
Ready to go; @jesmrec , your call. |
…ith option is enabled after that
7837874 to
a3c6be5
Compare
… has started to download
…g, and no more exceptions in user messages
Implements the feature of the issue #592