How to build app with offline video support features same like youtube in ionic?

I have a requirement where I need to download videos from my app and store them within the app so that the videos are not accessible from the folders, but can be viewed only from the App. the way youtube offline support work same functionality i want it in my app

any one have solution?

Thanks in advance :slight_smile:


hey @amitk04
I want to do the same thing which you’re trying. You achieved it??

Thank in advance :slight_smile:

hey @pallavibiwal
i am trying too much but i am not get any proper solution.

I succeed in doing that by using ionic Filetransfer plugin

import { FileTransfer, FileUploadOptions, FileTransferObject } from ‘@ionic-native/file-transfer’;
constructor(private transfer: FileTransfer,public platform: Platform) {

    this.platform.ready().then(() => {
        // make sure this is on a device, not an emulation (e.g. chrome tools device mode)
        if(!'cordova')) {
          return false;

        if ('ios')) {
          this.storageDirectory = cordova.file.documentsDirectory;
        else if('android')) {

            file.createDir(file.externalDataDirectory, 'media', true).then((result)=>{

             console.log("Directory created"+result);

            this.storageDirectory = cordova.file.externalDataDirectory+ 'media/';
        else {
          // exit otherwise, but you could add further types here e.g. Windows
          return false;


let fileTransfer: FileTransferObject = this.transfer.create();, this.storageDirectory + type+"-"+filename[1]).then((entry) => {
}, (error) => {
const alertFailure = this.alertCtrl.create({
title: Download Failed!,
//subTitle: was not downloaded. Error code: ${error},
buttons: [‘Ok’]



Hope this help you :slight_smile:

1 Like

okay let me check then i will let you know if i face any issue.

hii, @amitk04
are you get the solution?
If you get the solution then help me.

can you please explain clearly…

great work!!!

but offline video not secure ,
how it is possible? any idea?.. @pallavibiwal

how can offline video will play in ionic 3 app. I am using videogular player for this.

The files stored locally in phone storage right it will increase the phone memories right? How to avoid this is it possible to store videos locally when it’s play in offline

Thanks in advance

It almost sounds like you’re asking “how do I store things on a device for offline use without using storage space on the device?”, but you’re not asking that, right?


You are correct. do you have any solution for this question
"how do I store things on a device for offline use without using storage space on the device?”.

Thanks in advance.

No, I do not have a solution to that question.

I had actually hoped that phrasing it the way that I did would bring the inherent impossibility of the idea into clearer focus, but I guess that was not a very successful way of going about that task.

You have to see it in this way : Can you put 1000 boxes of frozen pizza in a fridge while keeping the fridge empty at the same time?

1 Like