Mindinventory / vimeo_video_player

A Video Player For Vimeo Videos in Flutter. This plugin allows us to play video from Vimeo and it supports Android and iOS platforms.
https://www.mindinventory.com/flutter-app-development.php
MIT License
34 stars 37 forks source link

CORS issues when using VimeoVideoPlayer #31

Closed CodeNameNinja closed 9 months ago

CodeNameNinja commented 1 year ago

I have the following code

Center(
                child: VimeoVideoPlayer(
                  url: 'https://vimeo.com/${mediaItem.video_id}',
                ),
              )

This has been working previously, but suddenly this started throwing a CORS error

Access to XMLHttpRequest at 'https://player.vimeo.com/video/353189349/config' from origin 'https://my-sitename.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

No Configurations have been changed.

This is the version i have

vimeo_video_player: ^0.0.9
mohit-chauhan-mi commented 1 year ago

@CodeNameNinja Please disable web CORS using the steps below, it may fix your error.

Web cors 1- Go to flutter\bin\cache and remove a file named: flutter_tools.stamp 2- Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart. 3- Find '--disable-extensions' 4- Add '--disable-web-security'

Thanks.

CodeNameNinja commented 1 year ago

@mohit-chauhan-mi This issue is happening in production, and not happening locally, I am using firebase hosting and cloudflare for DNS resolution

CodeNameNinja commented 1 year ago

Figured out the issue, had to remove the version of main.dart in index.js in the web folder and redeploy to firebase

CodeNameNinja commented 1 year ago

Re-opened this issue, because the issue is still persisting, I can get the video player to load, but the video doesent load, due to CORS issues, I believe headers need to be added to the Dio.get() Request

mohit-chauhan-mi commented 9 months ago

@CodeNameNinja We've added one parameter named Options? dioOptionsForVimeoVideoConfig to add an option to the Dio GET request. There is no need to pass anything in the header for the Vimeo public API to get the video config but you may use this param to pass the headers that you want. Closing this issue for now feel free to re-open it if it still exists. Please check it with the latest version. Thanks.

Ortes commented 7 months ago

Is there a solution for this issue ? I ran into the same error and unable to resolve it. I use vimeo_video_player: 0.0.15 on a web platform and I allowed the domain in the privacy settings of the video but the config fetch still fail with with the same error Access to XMLHttpRequest at 'https://player.vimeo.com/video/<videoId>/config' from origin 'https://my-domain.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I tried in production and locally

@mohit-chauhan-mi Have I missed something ?