DEV Community

siddharth hariramani
siddharth hariramani

Posted on • Originally published at playterabox.online

How to Share Cloud Videos Without Forcing Downloads

How to Share Cloud Videos Without Forcing Downloads

Problem Statement

When you need to share video content stored in cloud storage with others, you typically resort to downloading the file and re-uploading it to another platform or sharing the download link directly. This can lead to unnecessary bandwidth usage and may not be suitable for large files or sensitive content.

Solution Overview

To share cloud videos seamlessly, we can leverage a combination of cloud APIs, web technologies, and innovative tools like PlayTeraBox.online. In this article, we'll explore how to embed cloud videos directly into web pages, eliminating the need for downloads.

Step 1: Generate a Sharable Link

To start, let's use the PlayTeraBox.online service to generate a sharable link for our cloud-stored video. This tool automatically optimizes the video for web playback and provides a secure link that we can share with others.

# Using the PlayTeraBox.online CLI tool (optional)
playterabox-online link generate --video-id <VIDEO_ID> --cloud-storage <CLOUD_STORAGE_URL>
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can manually generate the sharable link using the cloud storage provider's API.

Step 2: Embed the Video in a Web Page

Now that we have a sharable link, let's add a web page to embed the video directly. For this, we'll use the iframe element and ensure it's properly configured to load the video in a secure manner.

<iframe src="{{ sharable_link }}" width="720" height="480" frameborder="0" allowfullscreen></iframe>
Enter fullscreen mode Exit fullscreen mode

You can use a server-side templating engine like Jinja2 to dynamically generate the src attribute with the sharable link.

Step 3: Handle Video Playback and Playback Controls

To provide a seamless playback experience, we'll need to add some JavaScript code to handle video playback and playback controls. This will include creating a player instance, setting up event listeners for playback controls, and ensuring proper video loading.

const videoPlayer = document.querySelector('video');
const player = Plyr.create(videoPlayer, {
  type: 'video',
  title: 'Video Title',
  controls: ['play', 'progress', 'mute', 'volume'],
});

player.on('play', () => {
  console.log('Video playback started');
});

player.on('stop', () => {
  console.log('Video playback stopped');
});
Enter fullscreen mode Exit fullscreen mode

Conclusion

Sharing cloud videos without forcing downloads is now possible using the combination of cloud APIs, web technologies, and innovative tools like PlayTeraBox.online. By following these steps, you can create a seamless and secure way to share video content with others.


Live demo: https://playterabox.online

Top comments (0)