J.ck.wong
J.ck.wong

Reputation: 21

Android app cast HLS got error message No 'Access-Control-Allow-Origin'

I tried cast a m3u8 link to chromecast. But got below error message on debug page:

XMLHttpRequest cannot load http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.gstatic.com' is therefore not allowed access.

[cast.receiver.MediaManager] Load metadata error

I added below m3u8 link to the xml file from Google sample app "domocastplayer"

<media
    imageUrl="http://peach.blender.org/wp-content/uploads/poster_bunny_small.jpg"
    mimeType="application/x-mpegURL"
    studio="Peach Open Movie Project"
    title="u3m8 video"
    type="movie"
    url="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8" /> 

Can I know where to set the Access-Control-Allow-Origin header? or am I need add extra file for this?

Upvotes: 2

Views: 1243

Answers (2)

Safeer
Safeer

Reputation: 1467

Your issue clearly states that gstatic.com is not allowed to access media placed on your server. So, to get it done you need to add gstatic.com as allowed domain(or add in white-list) on server-side configurations. Then you will be able to play media on chromecast.

Thanks

Upvotes: 1

Leon Nicholls
Leon Nicholls

Reputation: 4646

You appear to be trying to play a video hosted on the apple servers. Since they have CORS enabled, they have configured it to not allow your receiver to play that video. All modern browsers including Google Cast will enforce CORS: https://developers.google.com/cast/docs/player#cors

Upvotes: 0

Related Questions