balvinderz / video_player_web_hls

Supports hls on chrome and other browsers.
BSD 3-Clause "New" or "Revised" License
52 stars 61 forks source link

[video_player_web_hls] Refused to set unsafe header "Cookie" #17

Closed mrinaljain closed 2 years ago

mrinaljain commented 3 years ago

I am using the video_player_web_hls on top of flick_video_player to play .m3u8 videos in my flutter web app. the plugin works fine for normal .m3u8 URLs but when I am trying to implement signed cookies for web and pass cookies in header. I get the following error which says Refused to set unsafe header "Cookie" Screenshot 2021-09-10 at 1 55 26 PM

Can you please help me out if its something wrong implemented from my side or its problem from the plugin side.

Following is my sudo code examples which I have tried

  1. Example 1

    `String cookie = "CloudFront-Policy=$cloudFrontPolicy" + ";CloudFront-Signature=$loudFrontSignature" +
          ";CloudFront-Key-Pair-Id=$cloudFrontKeyPairId";
    
      httpHeaders = {
        "useCookie": "true",
        "Cookie": cookie,
      };
    
      playerController = VideoPlayerController.network(playUrl,
        httpHeaders: httpHeaders,
     );`
  2. Example 2

      `httpHeaders = {
         "useCookie": "true",
        "CloudFront-Policy": "${_cookieDetails.cloudFrontPolicy}",
        "CloudFront-Signature": "${_cookieDetails.cloudFrontSignature}",
        "CloudFront-Key-Pair-Id": "${_cookieDetails.cloudFrontKeyPairId}"
      };
    
      playerController = VideoPlayerController.network(playUrl,
        httpHeaders: httpHeaders,
     );`
balvinderz commented 3 years ago

It should be useCookies not useCookie

mrinaljain commented 3 years ago

Sorry I am using useCookies only but I wrote useCookie here by mistake.

The code is live here if you wanna have a look and debug http://m.stage.in/

balvinderz commented 3 years ago
Screenshot 2021-09-12 at 3 39 26 PM

all i get on your videos are CORS errors.

mrinaljain commented 3 years ago

Can we connect over a quick vc so that I can explain the problem much better.

Whatever time suits you the best.

balvinderz commented 3 years ago

On Saturday , after 11 am . You can message me on discord - balvinderz#1151

balvinderz commented 2 years ago

Closing because this is inactive for a long time.

Rahim47 commented 1 year ago

Hello @mrinaljain @balvinderz, I am getting the same error while trying to login to my web app, have you managed to resolve yours?