Trouble with Hosted Assets and subdomains *SOLVED*


#1

I have a website with 2 subdomains that share a lot of the same local assets.

For example, lets say mySite.com has an audio folder within subDomain1. How do I set things so that Blocs can access those audio files in subDomain2?

mySite
   subDomain1
      audio
         sample1.mp3
         sample2.mp3
         sample3.mp3

   subDomain2

Of course, I could duplicate the assets, by giving subDomain2 its own audio folder, but I’m thinking there must be better way. For example, a relative address like …/subDomain1/audio/sample1.mp3
etc…

My problem is that I don’t know how to add the assets to the subDomain2 Blocs project? Can someone point me in the right direction?

Thanks,
-Tony


#2

@Tony unfortunately you won’t be able to use relative links. You’ll need to use the full URL to access assets on these subdomains. i.e.

https://subdomain.mysite.com/audio/sample1.mp3

There are more technical ways like:

  • htaccess redirects
  • javascript redirects (last resort)
  • proxys (requires php)

#3

@tony just an idea…
What about you create a folder in your server called “audio” and both subdomains can use the same folder, just instead point the mp3 to the local address like “/audio/file.mp3” you point that to “http://domain.xxx/sources/audio/file.mp3”

Just an idea…


#4

@Pealco and @Whittfield thank you for your help. I wanted to try your suggestions, but discovered that I couldn’t get past the first step. That is, I couldn’t figure out how to get “Hosted Assets” to work for me at all (I’ve always used local assets up to now). If you can help me that would be great, otherwise maybe I should post a new thread? Let me know

Here’s what I tried: I opened a new Blocs project, added an audio player and then used the “Add Hosted Asset” in the Asset Manager
36%20AM
then, into the URL box I pasted the following test audio I found on the web:
https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3
and finally assigned that audio to the audio player:
00%20AM
But when I build my project and test it I get no audio. Then, viewing the page source I can see that it is trying to link to the audio as if it were a local asset.

I must be doing something wrong in Blocs because that audio plays immediately if you copy the link to a browser. I also wanted to try the “Bulk Add Hosted Assets” (which looks like a great feature) but I had no idea how to use that [see note* below]. I’ve looked in the documentation and in the forum for more instructions on using hosted assets and bulk hosted assets but found nothing helpful.

One more thing I noticed: The Asset manager seems to understand that this is a hosted asset because right-click --> “Open in Browser” works fine. However, right-click --> “Preview Audio” doesn’t work. If this is normal behavior, it’s confusing why “Preview Audio” would be in that menu.

43%20AM

Thanks,
-Tony

*note: regarding how to use “Bulk Add Hosted Assets”, Norm helped me on that. In brief, you copy the urls for the hosted assets into the text box like this: url1,url2,url3,url4 etc… for example url1 might be the text:

https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3

No quotes or spaces are needed–just commas between each url. Then you place a comma into the separator box.


#5

You’r absolutely right…
@Eldar is this a bug, or a normal situation? Do we have to report it to @Norm or not?

@Tony for now, you can add a Div Bric, and inside that Bric you add a Code Bric.
And then you add the following code:

<audio id="myAudio" width="100%" height="100%" controls="">
  <source src="https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3" type="audio/mp3" class="">
  Your browser does not support HTML5 audio.
</audio>

And where you found the src= you put your mp3 subdomain.domain.com/file.mp3

Is what works for now…


#6

I reported it as a bug.


#7

This is was an issue and has now been patched, the fix will be included in 3.2 beta build 6


#8

Thank you for the fix – it works as long as the files have simple names.

But I cannot get it to work if filenames include spaces, apostrophes, or quote marks. I notice that the above are converted into %20, %27, and %22 in a browser. If I try adding a file with spaces or quote marks using “Add Hosted Asset” it will not allow the file to be added (“Add” button grayed). If I replace the spaces with %20 then it will allow me to add the asset, but a blue square with a ? mark appears in the image bric. Interestingly, the image does appear in the Hosted Assets dialog as well as the thumbnail in the right side panel (see screenshot below), so Blocs seems to be connecting to the image; but unfortunately, it does not connect to the image in the most important place.
40%20AM

I had similar experience with the “Bulk Add Hosted Assets” dialog. Al files without spaces, ', or " worked fine. So my questions are:

  1. Is there a way to get Blocs to recognize filenames with spaces, ', and " ?
  2. If not, do you know of a way to rename hundreds of files on my website host (without having to re-upload? – which for me would be a real pain).

Thanks,
-Tony


#9

I’ve now marked this problem as solved because I decided to remove spaces and other odd characters from my filenames using SSH access. It was painful, but I learned a lot. As mentioned above, the hosted asset feature works fine with Norm’s recent fix in 3.2.0 build 6

Thanks to all who helped.