srenshaw's Forum Posts

  • Hi Aekiro,

    I've just realised that the Scroll View will only accept images as content, not text. Is there any chance you could add this functionality as I plan to have a number of pop-ups that show instructions or dialogue and I'd like the user to be able to scroll the text in the pop-up.

    Great plug-in by the way - very useful so far :¬)

    Thanks,

    Steve.

  • Thanks Ashley, I've made some progress controlling the YouTube player inside the iFrame object. I'm using C3 buttons to send javascript commands such as:

    document.getElementById("myFrame").contentWindow.postMessage('playVideo','*');
    

    The following code in the iFrame listens for the commands then communicates with the YouTube player.

    window.addEventListener('message', function(event){
    
    	document.getElementById('message').innerHTML = event.data;
    
    	if (event.data == 'pauseVideo') {
    		pauseVideo();
    	} 
    
    });
    

    I would also like to pass information back to C3, such as the player state and the time elapsed. I thought I could do this by simply creating global variables in C3 and setting their values using the iFrame javascript:

    runtime.globalVars.playerState = pState; 
    

    However, I get the following console error:

    'Uncaught ReferenceError: runtime is not defined'

    Is it possible to access global variables from the javascript running in the iFrame object?

    Thanks, Steve.

  • I can successfully interact with the contents of an iFrame using C3's built in iFrame object and the new JavaScript facility. However, I can't figure out how to use this technique to control an embedded YouTube video.

    I've experimented with a couple of options but had no luck so far:

    Option 1: C3 JS sends commands directly to the YouTube iFrame which is embedded in the C3 iFrame.

    Option 2: C3 JS sends commands to the C3 iFrame, which then sends commands to YouTube iFrame.

    Unfortunately I don't know if either of these options is technically possible, and if so, what code to use.

    I've created a quick project to illustrate the problem and I'd be grateful if anyone can help with a solution (or put me out of my misery and tell me why it's not actually possible):

    https://www.dropbox.com/s/0nq8fhv5vuxu0x0/YTtest01.c3p?dl=0

    Many Thanks,

    Steve.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Jase00, did you have any luck with this? I'm also looking for a way to control a youtube video using C3. I'd like to be able to Play/Pause the video in it's iFrame, trigger events at a specific playback time and basically use C3 to control any aspect of the video that the Youtube IFrame Player API allows. Unfortunately I've had no luck so far - I can achieve results using just HTML and Javascript, but I can't get C3 to successfully replicate this functionality. Does anyone know if it's actually possible, and if so, how?

    Many Thanks,

    Steve.