M
M
Maxim js2021-02-19 09:07:04
PHP
Maxim js, 2021-02-19 09:07:04

How to reformat a link from YouTube?

when creating a section element, there is a field for entering a link to a YouTube video, I get it from <?= $arResult['PROPERTIES']['VIDEO']['VALUE'] ?> how to reformat the link for an iframe? That is, we insert into the input
https://www.youtube.com/watch?v=nXbCcaoVMCQand into the iframe itself we gethttps://www.youtube.com/embed/nXbCcaoVMCQ

<iframe class="media__iframe"
                    src="<?= $arResult['PROPERTIES']['VIDEO']['VALUE'] ?>"
                    frameborder="0"
                    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
                    allowfullscreen>
            </iframe>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2021-02-19
@iiiBird

google regular expressions to pull id from youtube video. for example https://stackoverflow.com/questions/6903823/regex-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question