2012-04-01 7 views
3

Ich verwende JWPlayer zum Streamen von Videos aus dem Azure-Blobspeicher. JWPlayer benötigt crossdomain.xml, um das Video abzuspielen.Zugriffspfad für die Datei crossdomain.xml für jwplayer

Ich habe versucht, crossdomain.xml Datei in das Stammverzeichnis und den Code in http://127.0.0.1:10000/devstoreaccount1/crossdomain.xml zu platzieren, aber JWPlayer sucht in http://127.0.0.1:10000/crossdomain.xml.

Gibt es trotzdem eine Umleitung von JWPlayer zu http://127.0.0.1:10000/devstoreaccount1/crossdomain.xml statt der Standard http://127.0.0.1:10000/crossdomain.xml?

Antwort

1

verbunden war oft ich diesen Code-Schnipsel verwende Crossdomainpolicy zu erstellen:

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; 
     } 
    } 

Im ConfigKey ich meine tatsächlichen Azure-Speicher-Konto Schlüssel oder Uselocalstorage passieren = wahr

-1

Sie könnten versuchen, den Web-Server zu konfigurieren, von wo auch immer im Document-Root zu holen, die ich in /devstoreaccount/ nehmen ist, sich die Datei befindet, und es zurückgeben, wenn /crossdomain.xml angefordert wird.

Oder Sie könnten Symlink /devstoreaccount/crossdomain.xml->/crossdomain.xml. Und dies würde Ihren Code nicht brechen, wenn es irgendwie zu /devstoreaccount/crossdomain.xml.