2016-08-03 211 views
0

我在AWS S3或互聯網上的某個地方有圖片或視頻。爲什麼我的視頻和圖片沒有顯示出來?

我試圖通過直接引用圖像路徑將紋理應用到一個盒子:

<a-scene> 
    <a-box src="https://blah.com/sometexture.png"></a-box> 
</a-scene> 

但什麼也不顯示。我得到了一些關於沒有圖像和CORS的控制檯錯誤。

回答

0

使用A-Frame 0.3.0,您不再需要手動指定crossorigin。它將自動設置在需要CORS的資產上。

https://aframe.io/faq/#why-does-my-asset-e-g-image-video-model-not-loading

一般情況下,這個問題是由於CORS。由於所有資產都是通過XHR獲取的,因此您需要在資產上啓用允許CORS標頭。如果您從S3服務,這很常見。一旦啓用CORS,你需要設置crossorigin標誌在你的資產:

<a-scene> 
    <a-assets> 
    <img id="texture" crossorigin src="https://blah.com/sometexture.png"> 
    <video id="texture2" crossorigin src="https://blah.com/sometexture.mp4"> 
    </a-assets> 

    <a-box src="#texture"></a-box> 
    <a-video src="#texture2"></a-video> 
</a-scene> 

我們確實有通過UploadCare提供了一個自由上傳。它是向下的那一刻,但以後你就可以在這裏上傳並獲得CORSed資產免費https://aframe.io/aframe/examples/_uploader/

在iOS上的Safari,如果仍沒有圖像加載,你可能以前裝好了沒有crossorigin並被緩存。嘗試清除瀏覽器緩存。

+0

此資源尚未運行?https://aframe.io/aframe/examples/_uploader/ –

相關問題