反应本机视频Cookie [英] React Native Video Cookies

查看:73
本文介绍了反应本机视频Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

对于IOS,我只需使用react-native-cookie-store库设置cookie:

  CookieManager.set({名称:"CloudFront-Key-Pair-Id",值:您的对ID",域:您的域",小路: '/',origin:'您的来源(与域相同),版本:"1",到期时间:"2099-05-30T12:30:00.00-05:00",}); 

针对CloudFront-Key-Pair-Id,CloudFront-Policy和CloudFront-Signature调用了3次此方法.

希望这会有所帮助!

I am trying to play a secured video from CloudFront with @react-native-community/react-native-video.

To reproduce the video I have to set 3 cookies: CloudFront-Key-Pair-Id, CloudFront-Policy and CloudFront-Signature.

I've been able to reproduce the video in IOS with this module: react-native-cookies

But I am not being able to reproduce the video in android. How can I set the cookies to play this video?

The video is a .m3u8 extension (HLS)

Thank you very much!

解决方案

I solved it.

Finally, to be able to reproduce it on Android I did the following on the Video component:

For IOS I just set the cookies with the react-native-cookie-store library:

CookieManager.set({
          name:'CloudFront-Key-Pair-Id',
          value: 'Your pair ID',
          domain: 'Your domain',
          path: '/',
          origin: 'Your origin (I used same as domain)',
          version: '1',
          expiration: '2099-05-30T12:30:00.00-05:00',
        });

Called this methods 3 times, for CloudFront-Key-Pair-Id, CloudFront-Policy and CloudFront-Signature.

Hope this helps!

这篇关于反应本机视频Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆