Access path for crossdomain.xml file for jwplayer
I am using JWPlayer to stream video from Azure blob storage, JWPlayer needs crossdomain.xml
to play the video.
I tried to put the file crossdomain.xml
in the root directory and the code in http://127.0.0.1:10000/devstoreaccount1/crossdomain.xml
, but JWPlayer looks for it in http://127.0.0.1:10000/crossdomain.xml
.
Do I need to redirect JWPlayer to http://127.0.0.1:10000/devstoreaccount1/crossdomain.xml
instead of default http://127.0.0.1:10000/crossdomain.xml
?
source to share
I often use this piece of code to create a Crossdomainpolicy:
var account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings[ConfigKey]);
var blobs = account.CreateCloudBlobClient();
CreateCrossDomainPolicy(blobs);
private static void CreateCrossDomainPolicy(CloudBlobClient blobs)
{
try
{
blobs.GetContainerReference("$root").CreateIfNotExist();
blobs.GetContainerReference("$root").SetPermissions(
new BlobContainerPermissions()
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
var blob = blobs.GetBlobReference("clientaccesspolicy.xml");
blob.Properties.ContentType = "text/xml";
blob.UploadText(@"<?xml version=""1.0"" encoding=""utf-8""?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-methods=""*"" http-request-headers=""*"">
<domain uri=""*"" />
<domain uri=""http://*"" />
</allow-from>
<grant-to>
<resource path=""/"" include-subpaths=""true"" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>");
}
catch (Exception Ex)
{
throw Ex;
}
}
In ConfigKey I will pass my account to Actual Azure account or Uselocalstorage = true
source to share
You can try configuring the webserver to fetch from anywhere in the root of the document which I believe is in /devstoreaccount/
, the file is located and returns it when requested /crossdomain.xml
.
Or you could symbolize /devstoreaccount/crossdomain.xml
→ /crossdomain.xml
. And it won't break your code if somehow it was linked to/devstoreaccount/crossdomain.xml.
source to share