D
D
Djuba Baghdad2021-04-02 19:39:34
Java
Djuba Baghdad, 2021-04-02 19:39:34

How to embed video in android app?

Good day, such a situation arose, I decided to create a small application for android, and here is the question:
How can I correctly add a video to the application itself?
What is the best and correct way to implement this function?
The bottom line is, let's say there are videos of different lengths and weights from a couple of MB to a couple of GB, and I want to add these video files to the application, but I need the video to open in the application itself, if I publish these videos on YouTube, and so that when the user clicks on it it played right away.
Please tell me how to implement it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-04-02
Hasanly @azerphoenix

Good afternoon!
Quite recently it took to write something similar. I am not an android developer, but I wrote a backend for the application and I know roughly how the client part works.
So:
1) It is important to understand exactly how you plan to deliver content to the client, i.e. how the video will be delivered to the application. If videos must be periodically added to the application, then it is clear that it makes no sense to pack them into the application. Then it makes sense either to create a zip archive, which, after installing the application, will be downloaded, unpacked and placed somewhere in the internal storage, or (even better) to write a full-fledged backend (REST service) that allows you to get a list of links to download videos, information about video (media data), etc.
2) If you do not plan to periodically publish new videos, then it makes sense to pack it into the application.
In my case it was implemented as follows. There was a REST service from where you could get a link to download the video and other data (video thumbnail, etc.).
And also a link to streaming video was additionally available. Accordingly, the user could watch the video online, and if he turned on the offline mode in the settings, then the video via REST was downloaded to the phone and was available offline.
Accordingly, depending on your goals, you may need a developer who needs to raise the backend

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question