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

Why VideoView setVideoUri(Uri uri,Headers headers) doesn't work? #177

Closed
xiaofans opened this Issue Jul 13, 2014 · 28 comments

Comments

Projects
None yet
5 participants
@xiaofans

xiaofans commented Jul 13, 2014

I want to add a Referer or other stuff,but do not work.

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 13, 2014

Contributor

It can work. I'm sure. What you wana add.

Contributor

crossle commented Jul 13, 2014

It can work. I'm sure. What you wana add.

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 14, 2014

Probably I made a mistake,the code like this.
HashMap<String,String> headers = new HashMap<String,String>();
headers.put("Referer","http://xxxxx.com?xxx&xxx");
mVideoView.setVideoUri(uri,heeaders);
is this correct?

xiaofans commented Jul 14, 2014

Probably I made a mistake,the code like this.
HashMap<String,String> headers = new HashMap<String,String>();
headers.put("Referer","http://xxxxx.com?xxx&xxx");
mVideoView.setVideoUri(uri,heeaders);
is this correct?

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 14, 2014

Contributor

What's Referer?

Contributor

crossle commented Jul 14, 2014

What's Referer?

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 14, 2014

Http Request Headers.

qq20140714144509

xiaofans commented Jul 14, 2014

Http Request Headers.

qq20140714144509

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 14, 2014

Contributor

Vitamio headers use FFmpeg AVOption, so you should add like

Map<String, String> options = new HashMap<>();
options.put("headers", "Referer:xxx\r\n");
Contributor

crossle commented Jul 14, 2014

Vitamio headers use FFmpeg AVOption, so you should add like

Map<String, String> options = new HashMap<>();
options.put("headers", "Referer:xxx\r\n");
@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 14, 2014

Thanks a lot, I will try.

xiaofans commented Jul 14, 2014

Thanks a lot, I will try.

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 14, 2014

Not work for me, maybe something is wrong in my code,still tks.

xiaofans commented Jul 14, 2014

Not work for me, maybe something is wrong in my code,still tks.

@xiaofans xiaofans closed this Jul 15, 2014

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Jul 18, 2014

I can confirm this is not working too. I cannot send custom HTTP headers using the "headers" option nor send cookies using the "cookies" option.

waninkoko commented Jul 18, 2014

I can confirm this is not working too. I cannot send custom HTTP headers using the "headers" option nor send cookies using the "cookies" option.

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 18, 2014

Contributor

Custom HTTP headers? What's headers?

Contributor

crossle commented Jul 18, 2014

Custom HTTP headers? What's headers?

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Jul 18, 2014

To play a MP3 HTTP URL, I need to send some specific HTTP headers. When I use the -headers parameter in FFmpeg (in my PC running ArchLinux) it works perfectly, but when I use the following in Vitamio...

Map<String, String> options = new HashMap<String, String>();
options.put("headers", ".................");

... It doesn't work at all (checked with Wireshark that the headers are not being sent).

waninkoko commented Jul 18, 2014

To play a MP3 HTTP URL, I need to send some specific HTTP headers. When I use the -headers parameter in FFmpeg (in my PC running ArchLinux) it works perfectly, but when I use the following in Vitamio...

Map<String, String> options = new HashMap<String, String>();
options.put("headers", ".................");

... It doesn't work at all (checked with Wireshark that the headers are not being sent).

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 23, 2014

@waninkoko do you find a way?

xiaofans commented Jul 23, 2014

@waninkoko do you find a way?

@xiaofans xiaofans reopened this Jul 23, 2014

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Jul 23, 2014

@xiaofans No luck for now :/

waninkoko commented Jul 23, 2014

@xiaofans No luck for now :/

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 23, 2014

Contributor

I test it ok. use headers AVOptions.

Contributor

crossle commented Jul 23, 2014

I test it ok. use headers AVOptions.

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Jul 23, 2014

I'm trying to make it work using the following code:

Map<String, String> options = new HashMap<String, String>();
options.put("headers", ".................");
mediaPlayer.setDataSource(context, uri, options);

But Wireshark still shows me that no headers are being sent.

waninkoko commented Jul 23, 2014

I'm trying to make it work using the following code:

Map<String, String> options = new HashMap<String, String>();
options.put("headers", ".................");
mediaPlayer.setDataSource(context, uri, options);

But Wireshark still shows me that no headers are being sent.

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Jul 23, 2014

Contributor

@waninkoko What's headers values? must be FFmpeg support headers.

Contributor

crossle commented Jul 23, 2014

@waninkoko What's headers values? must be FFmpeg support headers.

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Jul 23, 2014

@crossle I don't remember right now, but thay may be the issue. I'll check it further later and come back with the results.

waninkoko commented Jul 23, 2014

@crossle I don't remember right now, but thay may be the issue. I'll check it further later and come back with the results.

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Jul 23, 2014

@crossle had you test the Referer header?

xiaofans commented Jul 23, 2014

@crossle had you test the Referer header?

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Aug 2, 2014

Now I am pretty sure this can not work. the server receive anything.I test the MediaPlayer in android.the method setDataSource(context,uri,headers) can work.but can't send referer option.

xiaofans commented Aug 2, 2014

Now I am pretty sure this can not work. the server receive anything.I test the MediaPlayer in android.the method setDataSource(context,uri,headers) can work.but can't send referer option.

@waninkoko

This comment has been minimized.

Show comment
Hide comment
@waninkoko

waninkoko Aug 2, 2014

Yesterday I tried to send a referer, and it worked perfectly.

waninkoko commented Aug 2, 2014

Yesterday I tried to send a referer, and it worked perfectly.

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Aug 2, 2014

you sure? what is your code? like before?

xiaofans commented Aug 2, 2014

you sure? what is your code? like before?

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Aug 2, 2014

@waninkoko can you show it for me plzzzzzzzzzzzzzzzzzzzzzzz

xiaofans commented Aug 2, 2014

@waninkoko can you show it for me plzzzzzzzzzzzzzzzzzzzzzzz

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Aug 10, 2014

The Referer finally added. I forget add "\r\n".

xiaofans commented Aug 10, 2014

The Referer finally added. I forget add "\r\n".

@xiaofans xiaofans closed this Aug 10, 2014

@crossle

This comment has been minimized.

Show comment
Hide comment
@crossle

crossle Aug 10, 2014

Contributor

OOOOOPS! I have tell you options.put("headers", "Referer:xxx\r\n");

Contributor

crossle commented Aug 10, 2014

OOOOOPS! I have tell you options.put("headers", "Referer:xxx\r\n");

@xiaofans

This comment has been minimized.

Show comment
Hide comment
@xiaofans

xiaofans Aug 11, 2014

so sorry about this and tanks.

xiaofans commented Aug 11, 2014

so sorry about this and tanks.

@Vaishnavi-optisol

This comment has been minimized.

Show comment
Hide comment
@Vaishnavi-optisol

Vaishnavi-optisol Aug 4, 2016

Map headers = new HashMap();
headers.put("Cookie","CloudFront-Signature=xx; Domain=xx; Path=xx);
headers.put("Cookie","CloudFront-Policy=xx; Domain=xx; Path=xx");
headers.put("Cookie","CloudFront-Key-Pair-Id=xx; Domain=xx; Path=XX");

    mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mediaPlayer.setDataSource(MediaPlayerService.this, Uri.parse("URL"),headers);
    mediaPlayer.prepare();
    mediaPlayer.start();

I'm playing audio like this but it throughs only error. Audio not getting played

Vaishnavi-optisol commented Aug 4, 2016

Map headers = new HashMap();
headers.put("Cookie","CloudFront-Signature=xx; Domain=xx; Path=xx);
headers.put("Cookie","CloudFront-Policy=xx; Domain=xx; Path=xx");
headers.put("Cookie","CloudFront-Key-Pair-Id=xx; Domain=xx; Path=XX");

    mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mediaPlayer.setDataSource(MediaPlayerService.this, Uri.parse("URL"),headers);
    mediaPlayer.prepare();
    mediaPlayer.start();

I'm playing audio like this but it throughs only error. Audio not getting played

@FloridaStream

This comment has been minimized.

Show comment
Hide comment
@FloridaStream

FloridaStream Aug 4, 2016

@Vaishnavi-optisol u need to add \r\n at end, see examples man =)

#177 (comment) exemples

FloridaStream commented Aug 4, 2016

@Vaishnavi-optisol u need to add \r\n at end, see examples man =)

#177 (comment) exemples

@Vaishnavi-optisol

This comment has been minimized.

Show comment
Hide comment
@Vaishnavi-optisol

Vaishnavi-optisol Aug 5, 2016

@FloridaStream : Thanks for your response I also tried in the way you mentioned above like this.

Map<String, String> headers = new HashMap<String, String>();
headers.put("Cookie","CloudFront-Signature=xx\r\n");
headers.put("Cookie","CloudFront-Policy=xx\r\n");
headers.put("Cookie","CloudFront-Key-Pair-Id=xx\r\n");
headers.put("Cookie","Domain=xx\r\n");
headers.put("Cookie","Path=xx\r\n");

Still no luck. I even tried like - headers.put("headers","Cookie:CloudFront-Signature=xx; Domain=xx\r\n"); and
headers.put("headers","Cookie:CloudFront-Signature=xx\r\n; Domain=xx\r\n");

Thanks in advance

Vaishnavi-optisol commented Aug 5, 2016

@FloridaStream : Thanks for your response I also tried in the way you mentioned above like this.

Map<String, String> headers = new HashMap<String, String>();
headers.put("Cookie","CloudFront-Signature=xx\r\n");
headers.put("Cookie","CloudFront-Policy=xx\r\n");
headers.put("Cookie","CloudFront-Key-Pair-Id=xx\r\n");
headers.put("Cookie","Domain=xx\r\n");
headers.put("Cookie","Path=xx\r\n");

Still no luck. I even tried like - headers.put("headers","Cookie:CloudFront-Signature=xx; Domain=xx\r\n"); and
headers.put("headers","Cookie:CloudFront-Signature=xx\r\n; Domain=xx\r\n");

Thanks in advance

@Vaishnavi-optisol

This comment has been minimized.

Show comment
Hide comment
@Vaishnavi-optisol

Vaishnavi-optisol Aug 5, 2016

@FloridaStream

Thanks for the support. It works now for me I tried like below:
headers.put("Cookie","CloudFront-Policy=xx; CloudFront-Signature=xx; Domain=xx; Path=xx\r\n");

Vaishnavi-optisol commented Aug 5, 2016

@FloridaStream

Thanks for the support. It works now for me I tried like below:
headers.put("Cookie","CloudFront-Policy=xx; CloudFront-Signature=xx; Domain=xx; Path=xx\r\n");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment