Message Boards Message Boards

How to embed a YouTube video in a cloud notebook

Posted 9 years ago

Hi,

I am attempting to embed a YouTube video in a cloud notebook. Wolfram says it is available in Mathematica Online in his announcement. However, I can't figure it out. Has anyone successfully done this? If so, can you give me a peek at your function calls? Thanks.

Mike

POSTED BY: Michael McCain
12 Replies

If you write

EmbeddedHTML["

then paste the embedding script, Mathematica will ask you in a pop-up to deal with this automatically, just click yes and it will be pasted in the correct format. Then add

"]
POSTED BY: Ahmed Elbanna
Posted 2 years ago

Many thanks. It works fine, but I am not sure to have well understood when to put a \ . Each time we have a double quote ", we need a \ before, but sometimes there is a \ when there is no " ... May be you put additional ones at each end of line ?

Thanks again

POSTED BY: Yvan Abbe

You are right, EmbeddedService[ ] doesn't currently work with YouTube videos, and we are working to fix this.
That is why I suggest using EmbeddedHTML[ ] instead, by providing the Share -> Embed script from the YouTube video webpage. Try this

EmbeddedHTML["<iframe width=\"560\" height=\"315\" \
src=\"https://www.youtube.com/embed/mBpGUPCXQhk\" title=\"YouTube \
video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; \
clipboard-write; encrypted-media; gyroscope; picture-in-picture\" \
allowfullscreen></iframe>"]
POSTED BY: Ahmed Elbanna
Posted 2 years ago

Thanks for that quick answer: If I want to embed a Vimeo video, it works fine, but not with YouTube. Here is an example coming from the Wolfram Documentation that doesn't workif I try to use it :

EmbeddedService[{"YouTube", "mBpGUPCXQhk"}]
POSTED BY: Yvan Abbe

EmbeddedHTML[ ] works fine with YouTube videos. Could you please provide an example that doesn't work along with your code?

POSTED BY: Ahmed Elbanna
Posted 2 years ago

Hi all, It seems it doesn't work anymore, at least not exactly the same way.... Would need of refreshing the proc├ędure. Thanks

POSTED BY: Yvan Abbe

Additional code which implements the various YouTube web player options:

http://community.wolfram.com/groups/-/m/t/426362

POSTED BY: Arnoud Buzing

I sent Wolfram the information too. It looks like they have sent this information to their developers for a fix. Until then, I recommend using Chrome. Hope this helps. And thanks again Pieter!

Hello Michael McCain,

Thank you for contacting Wolfram Technical Support.

I see from your Wolfram Community post ( http://community.wolfram.com/groups/-/m/t/410913?p_p_auth=f1Eb8bFV ) that there is an issue with the code only when using Mathematica Online on the Safari web browser. It does seem that video embedding is not behaving properly in this case and I have forwarded an incident report to our developers with the information you provided.

We are always interested in improving Wolfram products and services and I want to thank you for bringing this issue to our attention.

Please don't hesitate to contact us, if you run into any other behavior problems.

Regards, Abhinav Verma Wolfram Technology Engineer Wolfram Research, Inc.

POSTED BY: Michael McCain

When I try evaluating the cell a second time... I get a blank cell in return. I am running Safari 8.0.2 on OS 10.10.1.

POSTED BY: Michael McCain

Thank you! I tried this before and it didn't work in Safari on my mac. Knowing that my coding was correct... I tried this in Chrome on my mac. It works!

It looks like there is a problem in Safari. The closest I get to work can be seen in the quicktime movie I linked you to below. The file is in .mov format. As you can see... I start to get a video but the video flickers on and off repeatedly and never plays. I completely reset safari and even tried it on another mac. Both have the same problem. Is there a fix for this? Some setting that needs to be changed in Safari perhaps?

Thank you so much for confirming my coding. I thought I was missing something.

Problem in Safari

POSTED BY: Michael McCain

Hello Michael,

its very easy, normally in a webtool you use:

<iframe width="854" height="510" src="//www.youtube.com/embed/60P7717-XOQ" frameborder="0" allowfullscreen></iframe>

to do this in a webnotebook use EmbeddedHTML[]. Note: you must change the "-signs by '- signs !

EmbeddedHTML[ "<iframe width='854' height='510' src='//www.youtube.com/embed/60P7717-XOQ' frameborder='0' allowfullscreen></iframe>"]

Just to be sure. Don't use this command in a Desktop notebook because it does not work and it provides no error.

FYI... here is Stephen Wolfram's announcement: http://blog.wolfram.com/2014/09/15/launching-today-mathematica-online/

About halfway down the page it reads...

...enter image description here

POSTED BY: Michael McCain
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract