0

I need a functionality to save videos offline and protect video-content. So that content will be encrypt and will play in my app only.

I am using HLS streaming. So i am planning to use react-native-video

<Video source={{uri: <video_url> }}
       drm={{ <DRM_details> }}
       onBuffer={this.onBuffer}
       onError={this.videoError}
       style={styles.backgroundVideo} />

drm= {{
    type: '<DRM_Type>',
    licenseServer:'<License_server_url>',
    headers: {
        'X-AxDRM-Message':'<token>',
        'Transfer-Encoding': 'Chunked',
        'Content-Type': 'application/octet-stream'
    }
}}

So i am using the above code i am facing some problems in this.

Problem 1:- I have a url with .m3u8 format. so it is playing in video player in my app that is fine. Now i want to save this video in my app. So in format will i save in the mobile so it will be in encrypt form?

Problem 2:- Will i have to make encryption in my app or i will get it from HLS streaming server?

Problem 4:- where from i can get DRM license key? will it help to protect my offline downloader videos?

Problem 4:- How that format i will play in my app from my local storage? So that user can play videos from local when is offline.

If anybody can clear me out on these things it will be great help.

Rambler
  • 267
  • 1
  • 12
  • 1
    **(1)** M3U8 is not a video file, it is a playlist (text) file with links to actual video files. To save as one file, you have to get **all** video pieces listed in playlist and join them (this means create a bytes Array and write in there the values of your pieces then save as file) **(2)** HLS is not encryption. You have to implement it yourself or pay for some video encryption service. **(3)** You can't because you have no DRM key (from encryption service). **(4)** MP4 is a good choice for save format. Maybe you can even edit those bytes yourself (make unplayable to others) – VC.One Jan 14 '22 at 03:15
  • Hi @VC.One as the files can be large upto 2GB. So react native will not able to handle it in byte array and will crash. So as i need to encrypt it then i have to download any format before before encryption then have to delete original file. – Rambler Jan 14 '22 at 04:55
  • Why not just save multiple files in one folder? Your playlist already has listing of multiple separate files so read each one into the Array, encrypt data and then save (one at a time), repeat with next item in playlist (usually recycling the Array for re-use here). – VC.One Jan 16 '22 at 23:37
  • @Rambler I need to add same functionality for my app. Can you please share how did you achieve this functionality? – Faisal Shaikh Mar 07 '22 at 11:13
  • @FaisalShaikh Still not found any good reference to implement like this. – Rambler Mar 07 '22 at 12:09
  • @Rambler are you sending cookies too? – Faisal Shaikh Dec 07 '22 at 21:08

0 Answers0