openHPI / xikolo-android

📱 Android App of the HPI MOOC Platform
https://play.google.com/store/apps/dev?id=7185448023325736337
GNU General Public License v3.0
41 stars 15 forks source link

Chinese letters in video URLs break video player #37

Closed cwillems closed 7 years ago

cwillems commented 8 years ago

originally reported by Sheng Luo

tobiasrohloff commented 8 years ago

Please provide an example url for testing.

shls commented 8 years ago

http://stream1.openune.org/stream/2015/2014全球城市化信息论坛开幕-01.mp4

tobiasrohloff commented 8 years ago

Hmm, the problem is a bit more complicated. These symbols are not allowed in an URL and have to be encoded. But I cannot encode the whole URL and also not the whole path after the host. Therefore I have to know where these symbols can appear for all Chinese platforms.

shls commented 8 years ago

Until now the chinese string only appears in the name of video file.

tobiasrohloff commented 8 years ago

The best solution would be to not use these characters at all in an URL. They cause problems across the whole app, because they are not allowed in URLs.

I would have to define provider specific encoding rules. E.g. your openUNE example needs an encoding after the last slash, but this rule breaks Vimeo URLs for openHPI and openSAP. openHPIcn still works, but are there any Chinese characters somewhere used? And what about cnMOOChouse? I need an exact schema on which platform these characters can appear at which place of the URL. Without I cannot guarantee that we perhaps end up with invalid URLs.

I think this not only applies to the video player, but files in general. I could image that the video download/offline playback also breaks.

cwillems commented 8 years ago

I would suggest for a convention (or maybe even a file upload validation) in the admin backend, that restricts chinese letters... @shls do you think, this is acceptable for chinese customers?

tobiasrohloff commented 8 years ago

I also would prefer to fix this on the backend side. The URLs are provided by the API, and I think we should ensure that our API delivers valid URLs only. If not, we have to fix this at every client for every URL usage.

shls commented 8 years ago

Video URL which only can be edited by admin:

General file:

From my perspective, It is painful for chinese user/customers if they can not use chinese when adding video URL or uploading file.

cwillems commented 8 years ago

How about the backend automatically renaming files - at least those which are uploaded in the backend? For video files, there must be a convention, as long as we don't upload those via the platform...

shls commented 8 years ago

Now on openhpi.cn, as far as I know, when I upload one general file, it will be renamed with file ID which is generated by our platform. The method make it possible to download file via desktop browser. Am I right? For android user, if our platform already renamed the general file, it should be downloadable.

Regarding the video URL, I can help to forward your solution, if they only use English in the filename and URL. The video can be downloadable and used as offline video.

Of course, If you are willing to integrate qiniu service in our platform, I am happy to provide the API manual.