What is the error playing an URL on AVPlayer?

Heitor Canabal

New member
Mar 20, 2015
1
0
0
Visit site
Hi!

I am trying to play an mp4 video from an URL but it does not work. That is my code:

AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:#MY_URL#]];
avPlayer = [AVPlayer playerWithPlayerItem:playerItem];

I tested the same code with an S3 (Amazon AWS) URL and worked.

I used an chrome plugin to get header of the two URLs to see the difference.

Amazon S3 header response:

Status Code: 200
Date: Fri, 20 Mar 2015 11:11:50 GMT
Last-Modified: Thu, 19 Mar 2015 13:46:30 GMT
Server: AmazonS3
x-amz-request-id: DE5FE905604FA9F1
ETag: "9601ded7e0a0652216ec243632f062d7"
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 554344
x-amz-id-2: 8kNyctTB5Hz8J+aDJu75X6rOZlZwtCAeqjNMCanEcB0lOM5XZNMkix8XmP/9p1ZRhpzLu3Vidnk=

URL that not work header response:

Status Code: 200
Date: Fri, 20 Mar 2015 11:26:21 GMT
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Apache
Transfer-Encoding: chunked
Content-Type: application/octet-stream
Access-Control-Allow-Origin: *
Content-Disposition: inline; filename=CHAMADO_297_0.63640400 1426796516.mp4
Connection: Keep-Alive
Keep-Alive: timeout=5, max=500

What is the error?

Thanks!
 

yww

New member
Oct 22, 2015
1
0
0
Visit site
hey,I found that if the content type of your response is "application/octet-stream" ,the avplayer will nerver work,try to change it to "audio/mpeg"
 

Trending Posts

Members online

Forum statistics

Threads
260,358
Messages
1,766,540
Members
441,240
Latest member
smitty22d2