Report this

What is the reason for this report?

How to use DO Object storage for Video on demand service?

Posted on March 22, 2021

We are running an android app which delivers recorded video classes to students. We want to use DigitalOcean(DO) Object storage to host the videos. I also want to set speed and quality control of the videos. I Know I can host the videos on DO. But after hosting here, how do I play on my app. If I will put the link to my default android player, will I be able to set speed control or quality control of the video. Will I have to use any intermediate service to do that. Please help me to do that. I search over the net, but did not get any proper documentation.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Once the static content is uploaded to your DigitalOcean space you will need a media player library to control the videos itself.

Additional libraries might be required to control the speed or the quality of the videos. For quality control, you might need to encode your videos in multiple resolutions/bitrates. Your app can select the appropriate video quality based on the user’s network connection or preferences.

Hope that this helps!

Hi there,

To use DO Object storage for Video on demand service, follow these steps:

  1. Create a DigitalOcean Object Storage bucket. You can do this through the DigitalOcean control panel or the DO API.
  2. Upload your videos to the bucket. You can do this using the DigitalOcean Spaces CLI tool, the DO Spaces web interface, or the DigitalOcean API.
  3. Create a DigitalOcean Spaces endpoint. This endpoint will provide a public URL that you can use to access your videos.
  4. Configure your video player to use the DigitalOcean Spaces endpoint. This process will vary depending on the video player you are using.

Once you have completed these steps, you will be able to play your videos on your Android app using the DO Spaces endpoint.

To set speed and quality control of the videos, you will need to use an intermediate service such as JW Player or MediaElement.js. These services provide a variety of features for streaming videos, including speed and quality control.

Here is an example of how to use JW Player to stream a video from DO Object storage:

<div id="my-video"></div>

<script src="https://cdn.jwplayer.com/jwplayer/8.16.5/jwplayer.min.js"></script>

<script>
jwplayer("my-video").setup({
  file: "https://your-do-spaces-endpoint/my-video.mp4",
  controls: true,
  plugins: {
    speed: true,
    quality: true
  }
});
</script>

Use code with caution. Learn more content_copy

This code will create a video player with speed and quality controls. The file property specifies the URL of the video in DO Object storage.

You can also use MediaElement.js to stream videos from DO Object storage. MediaElement.js is a lightweight JavaScript library that provides a variety of features for streaming videos, including speed and quality control.

Here is an example of how to use MediaElement.js to stream a video from DO Object storage:

<video id="my-video"></video>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/5.1.1/build/mediaelement-and-player.min.js"></script>

<script>
var player = new MediaElementPlayer("#my-video", {
  src: "https://your-do-spaces-endpoint/my-video.mp4",
  plugins: ["speed", "quality"]
});
</script>

This code will create a video player with speed and quality controls. The src property specifies the URL of the video in DO Object storage.

I hope this helps!

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.