How to play a Muted embedded Youtube Video


(Nim) #1

Hi,
i’m looking how to use THIS solution in Hype.

I already checked this one, but it’s not my case:


(Mark Hunte) #2

The solution you point to also mention the API will be depriciated at some point
A new API can be found on the same page you provided…!!

Unfortantly we are not mind readers or remote viewers. :slight_smile:
What is your case?


(Nim) #3

Sorry, probably I wasn’t clear…

I already found the solution you linked here (and many others…), but as the link I posted in the topic, I dunno how to implement it inside Hype. That’s my problem…

About the Last line (It’s not my case) I thought It was clear, my case is “Muted Embedded Youtube video” and Not as the link below… No need to be “remote viewers”…


(Mark Hunte) #4

What I mean is we can offer solutions but without an idea of your actual setup it would all be guess work, leading to more questions.

Please post something to show what you are doing and why the current solutions do not work for you.


(Nim) #5

There isn’t an actual set up. Simply I don’t know how to set this (https://developers.google.com/youtube/iframe_api_reference) in Hype…That’s it…“Play a Muted Embedded Youtube Video in Hype” (the topic’s title)

I’m not a dev (That’s why I use Hype :wink: ) so it’s not easy for me (and for others Hypers too) to set a JS solution inside Hype…You know what i mean?
Probably my english is bizzarre, sorry about that…I’ll try like that:

Playing Muted Youtube video --> API Youtube JS solution --> Implement in Hype = How to do it?


Trigger a timeline after playing Youtube Video
(Mark Hunte) #6

Ok.

player.hype.zip (12.0 KB)

This is a straight transplant of it into Hype.

The main functions are placed in a Hype function.

The Player DIV is inside the innerHTML of the rectangle element in the scene.
The API is linked in the head.

But I am not sure you will understand any of that…


(Nim) #7

YES!!! Thanks! It works!!! That’s exactly what I would to do!


(Nim) #8

that’s the result of your solution! Thanks!

http://nimstudios.com/banner/WNF/300x600/Default.html


(Mark Hunte) #9

Cosa, nessun londra :scream:


(Nim) #10

:smiley: what??


#11

Hey guys,
in the example file that @MarkHunte posted, how would I go about triggering a command to tell the video to pause when a custom button is pressed.

Right now I named the rectange ‘video1’ and am triggering this code on click of another rectangle (button graphic): hypeDocument.getElementById(‘video1.player’).stopVideo();
This does not work.


(Mark Hunte) #12

Make sure the video rectangle has an id.

In this example it is video1

We have the button run a Hype function that runs

	var playerIFrameID = "video1";
	var palyPause = element.innerText
 

 

palyPause == 'Pause' ? (
  element.innerText =   'Play'
) : (
   element.innerText =   'Pause'   
);
	
	 var youtube_command = window.JSON.stringify( { event: 'command', func: palyPause.toLowerCase() + 'Video' } );
  
   document.getElementById(playerIFrameID).firstElementChild.contentWindow.postMessage( youtube_command, '*' );

player 3.hype.zip (14.6 KB)

ref:



#13

Excellent. Just needed to make sure the function exists ha.
Thank you so much!