Avatar

Any plans to support YouTube Videos? (Features)

by Auge ⌂, Friday, March 03, 2017, 11:29 (2612 days ago) @ Magma

Hello

Do you have any plans to support embedding YouTube videos natively?

No, not at the moment.

At the moment I use the hack I found on this site which works ok but it's not ideal, you cannot go full screen and you often get a text warning "The YouTube Flash API was officially deprecated"

Embedding videos is really tricky. Youtube is not the only video provider. When we include the an embedding of video/audio(?) from external sites we have to provide a solution, that is not dedicated to only one video site.

I did a little quick reearch on youtube.com and on vimeo.com.

Youtube offers an URL for sharing a video, that leads to the page of the video, and a HTML-fragment for embedding the video on a different site. Generally I found the same procedure on vimeo.com, but the HTML-fragment differs.

An example from Youtube:

<iframe width="560" height="315" src="https://www.youtube.com/embed/…" frameborder="0" allowfullscreen></iframe>

Youtube offers the fragment with only an iframe.

An example from Vimeo:

<iframe src="https://player.vimeo.com/video/…" width="640" height="384" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/…">This - That</a> from <a href="https://vimeo.com/…">Whom</a> on <a href="https://vimeo.com">Vimeo</a>.</p>

Vimeo offers the fragment as default with the iframe but additionally with a paragraph with informations about the video and the uploader. One can change the settings, so the fragment corresponds with the one from Youtube, but one must change the enhanced options for this. Not everyone will know, how to do this.

<iframe src="https://player.vimeo.com/video/…?byline=0&portrait=0" width="640" height="384" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

At that point we would have a similar structure for these two video providers. I've no idea who further providers are and how they handle the external embedding.

But that's irrelevant. I will not incorporate a function to include external HTML-code at all! Never ever! I hope, that the other team members agree with me. When we allow this form of HTML-code (an iframe), we will allow much to much.

The doable alterative would be to only include the URL from the fragment and to generate an iframe with the same attributes and the same size for every video provider with a script. The question is, is this easily operateable for the visitors of a forum? One needs a manual to extract the correct part of the fragment or we need a proper way to automate this (in JavaScript and PHP).

Idea:

put the complete HTML-fragment into a form field what starts an automatic check (via JavaScript) of the input for …

- … an iframe
- … the src-attribute of this iframe
- … maybe for the width- and height-attributes

Put the values into hidden fields.

After sending the data to the server an PHP-script checks the presence of the values in the hidden fields. When the values was transmitted from the form, the PHP-script takes these values, checks and stores them in the posting. If the values was not transmitted, the PHP-script performs the above described checks and extractions itself and does it's own tasks afterwards (checking and storing them).

This might be a way.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread