javascript - How to select a track in popcorn.js using a string and play it? -


So, it's slim:

popcorn on a youtube video and separate audio loops. There is a track like 'video' and 'audio 1' etc.

I have user interaction on a socket, sending commands to the windows in the form of stars like "Play_audio1". This string is then parsed using split .

So we receive:

  var messagesare = message.split ("_");  

The message is [0] my order, and the message [1] is the one who tracks it.

Problem

I am trying to execute the code using the window to select the track, and run the popcorn function on it Play () , but it is not working Shoot Undefined.

  case 'play': window [message] [1]] [play] (); break;  

Edit: strong>

To help add it, I have a popcorn. JS track code will include:

  var audio1 = Popcorn.smart ("# audio1", "audiofile1 .wav", {frame animation: true});  

and in your html

  & lt; Audio id = "audio 1" & gt; & Lt; / Audio & gt;  

popcorn.js fills it with your selected file, and to play, you usually just use

  audio1.play (). ;  

I think that because you use message array [1] for a window Are in the form of index. Perhaps you should try to make that variable first. Then use it inside the window.

var audiofile = messageAre [1];


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -