Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoPlayerController.networkUrl not sending HTTP headers correctly #21

Open
KrohnMi opened this issue Aug 13, 2023 · 1 comment
Open

Comments

@KrohnMi
Copy link

KrohnMi commented Aug 13, 2023

When using the VideoPlayerController.networkUrl constructor with custom HTTP headers, the headers are not being sent correctly to the server. Despite providing the necessary headers, the server does not receive the header information as expected.

Steps to Reproduce:

  1. Create a headers map with the required HTTP headers, including 'X-API_KEY' and 'User-Agent'.
final headers = {
   'X-API_KEY': 'HERE YOUR TEST KEY',
   'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
};
  1. Initialize a VideoPlayerController instance using the VideoPlayerController.networkUrl constructor, passing in the video URL and the custom headers.
final videoPlayerController = VideoPlayerController.networkUrl(
   Uri.parse('https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'),
   httpHeaders: headers,
);

await videoPlayerController.initialize()

Observe that the server does not receive the expected header information.

Expected Behavior:

The VideoPlayerController.networkUrl constructor should send the specified HTTP headers ('X-API_KEY' and 'User-Agent') to the server along with the video request. The server should be able to correctly receive and process the header information.

Actual Behavior:

The server does not receive the specified HTTP headers, even though they are provided through the VideoPlayerController.networkUrl constructor. This issue prevents proper communication between the client and the server, potentially causing unintended behavior or access restrictions.

@KrohnMi
Copy link
Author

KrohnMi commented Aug 13, 2023

https://github.com/flutter/packages/blob/main/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m

This is the original, where the headers are set. Let's see if this can be adopted.

Unfortunately, my knowledge of Objective-C is not very strong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant