nextcloud / nextcloud/android

About video playback history

Open
#9,081 1 comment 0 reactions 0 assignees View on GitHub
enhancement feature: media player
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### Why I need this function

I use nextcloud to store my own data and watch videos. When I watched animes few days ago, I found there was no such function to save my video playback histories, as I often stop watching video to do something else. I don't want to remember the video's current playback position every time I quit the nextcloud app.

### Current works I've done

After I forked this repository, I worked on it. And now I've added this function to my own repository. My solution is quite simple:

+ create a new directory in the same position with the video file, the name of this directory is `.${md5_string_of_video_parent_directory_id}`. It's a hidden file, and the reason to use a parent directory's id is that the id will never be changed after the directory is created, I guess.
+ While watching videos, upload a playback record file into the directory created above in background. This file is also named as `.${md5_string_of_video_id}`. And this file stores video's current playback position.
+ When seeking progress manually, upload a playback file immediately.
+ When video stops, upload a playback file immediately.
+ Upload a new playback record file to overwrite the old one every 5 seconds while the video is playing.
+ When starting a new video preview fragment/activity, calculate the md5 value of parent directory and current video file, download the target playback file into local temp directory and read the playback value if playback file exists, then just set the current position.

I admit it's not a very good solution since it might cost a lot of resources for the frequent uploading job.

### Better solution

A better solution is to create a durable connection(can be a websocket) with the nextcloud server, and save the video's playback record data to database instead of a file via the connection. But for now I don't know much about the server's code.

### Extra works

Actually I modified a lot after I forked the repository:

1. Change the orientation of `PreviewVideoActivity` to `sensorLandscape`;
2. Hide navigation bar in full screen mode in `PreviewVideoActivity`;
3. Fix the bug mentioned in issue https://github.com/nextcloud/android/issues/9060, just because it is too annoying when I debugged my new feature so I fixed it by the way.

I don't know whether point 1 and point 2 are acceptable for most people or not, but for me they are very helpful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.