Different Audio Files in Multi-Language Tours

Question

I started project for local municipality and created virtual tour. We also recorded voice audio for separate panoramas or groups in two languages – Latvian and English. I made also in two languages (tooltips) which works fine, but my problem is how to add separate audio files for english tour version. I’m absolute newbie in programming languages, but can make some changes in code.

Is there any ability to change audio to english version files when user changes tour language? Can it be done via index.xml and does anyone have some code which I can add somewhere?

Answer

You can do like this, open index.xml in code editor like notepad++, atom. Find (CTR+F) backgroundsound. It’ll find one by one code like this

backgroundsound="limbazi_lv_14.mp3"

change this to

backgroundsound="calc:'limbazi_'+tour_language+'_14.mp3'"

Now if tour_language is lv it’ll get limbazi_lv_14.mp3 if en it’ll get limbazi_en_14.mp3

Also, there is preloadSounds action in the index_skin.xml open it and find this action. There you have this code

preloadsound("limbazi_lv_14.mp3");

change it to

preloadsound(calc('limbazi_'+tour_language+'_14.mp3');

I didn’t test this, but seems should work for initial language, if the tour starts with ‘en’ language sounds will be ‘en’.

But for dynamic change when sound is playing and the user changes the language it might not work. There needs more code to update the sound.

Source

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.