Jak Mogę automatycznie odtwarzać wideo za pomocą nowego stylu osadzania kodu w Youtube?

Nie mogę dowiedzieć się, jak automatycznie odtworzyć wideo za pomocą nowego stylu embed code dla Youtube. Próbowałem dodać & autoplay=1 do adresu url, który działał w starym stylu, ale nie zadziałał. Na przykład http://www.youtube.com/embed/JW5meKfy3fY jest linkiem embed, ale http://www.youtube.com/embed/JW5meKfy3fY&autoplay=1 nie działa. Czy ktoś może mi powiedzieć jak to zrobić? Dzięki

Author: ben, 2010-08-04

9 answers

Myślę, że jeśli użyjesz zastąp " & "przez"?"w adresie URL film zostanie automatycznie załadowany.

Więc Twój url byłby: http://www.youtube.com/embed/JW5meKfy3fY?autoplay=1

Wygląda na to, że Google powinno to udostępnić, ale powiedziałbym, że używając"?"ma większy sens niż używanie"&".

 327
Author: matthewbauer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-06-30 16:30:23

Właściwie, będziesz musiał użyć "?"zamiast" & " tylko dla pierwszego parametru. Jeśli użyjesz więcej niż jednego parametru, będziesz musiał dodać " & "do łańcucha.

Na przykład, jeśli chcesz dodać autoplay i napisy, będziesz musiał dodać tę część do osadzonego adresu URL wideo: ?autoplay=1&cc_load_policy=1.

Wygląda to tak:
<iframe width="420" height="315" src="http://www.youtube.com/embed/
oHg5SJYRHA0?autoplay=1&cc_load_policy=1" frameborder="0"
allowfullscreen></iframe>
 28
Author: Sacha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-09-23 14:37:19

Okay To jest przykład nowego kodu osadzania filmów na youtube.

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="560" height="345" src="http://www.youtube.com/embed/8v_4O44sfjM" frameborder="0" allowFullScreen></iframe>

Jeśli chcesz go odtworzyć automatycznie, w : src="http://www.youtube.com/embed/8v_4O44sfjM": dodaj ?autoplay=1 parametr

Więc kod będzie wyglądał tak:

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="560" height="345" src="http://www.youtube.com/embed/8v_4O44sfjM**?autoplay=1**" frameborder="0" allowFullScreen></iframe>
Próbowałem tego na moim blogu i działa ! Hope this help (:
 5
Author: Amel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-06-13 10:15:27

Pomoc YouTube mówi, że &autoplay=1 musi być po identyfikatorze wideo - zakładam, że zaraz po.

 4
Author: Anton Gogolev,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-08-04 12:01:18

Żadne z powyższych nie zadziałało dla mnie w aktualnym embedu youtube. Spróbuj tego, to naprawdę działa dla mnie:)

Mam nadzieję, że to pomoże!
<iframe width="925" height="315" src="https://www.youtube.com/embed/iD5zxjySOzw?rel=0&amp;autoplay=1&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
 4
Author: Kate at Gavin Academy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-11 18:40:29

Używasz niewłaściwego adresu url do automatycznego odtwarzania youtube http://www.youtube.com/embed/JW5meKfy3fY&autoplay=1 Ten adres URL wyświetla identyfikator youtube jako całośćJW5meKfy3fY&autoplay=1 który youtube odrzuca do odtwarzania. musimy przekazać zmienną autoplay do youtube, dlatego musisz użyć ? zamiast &, więc twój adres url będzie http://www.youtube.com/embed/JW5meKfy3fY?autoplay=1, a ostateczny iframe będzie taki.

<iframe src="http://www.youtube.com/embed/xzvScRnF6MU?autoplay=1" width="960" height="447" frameborder="0" allowfullscreen></iframe>
 4
Author: Waheed ur Rehman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-12-27 16:18:57

Wystarczy dodać ?autoplay=1 po adresie url w kodzie embed, przykład:

<iframe width="420" height="315" src="http://www.youtube.com/embed/
oHg5SJYRHA0" frameborder="0"></iframe>

Zmień na:

<iframe width="420" height="315" src="http://www.youtube.com/embed/
oHg5SJYRHA0?autoplay=1" frameborder="0"></iframe>
 3
Author: Ajie Kurniyawan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-10-06 14:07:59

Jedynym sposobem, w jaki udało mi się uruchomić autoplay, było użycie interfejsu API iframe player.

<div id="ytplayer"></div>
<script>
// Load the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// Replace the 'ytplayer' element with an <iframe> and
// YouTube player after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
    player = new YT.Player('ytplayer', {
        height: '480',
        width: '853',
        videoId: 'JW5meKfy3fY',
        playerVars: {
            'autoplay': 1,
            'showinfo': 0,
            'controls': 0
        }
    });
}
</script>
 3
Author: Jules,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-04-04 10:26:18

Żaden z Was nie rozwiązał mojego problemu. Ale znalazłem dobre rozwiązanie dla mnie, aby działać prawidłowo teraz. Pomiędzy znacznikami wpisz ten kod:

<div style="position: fixed; z-index: -99; width: 100%; height: 100%">
  <iframe frameborder="0" height="100%" width="100%" 
    src="https://youtube.com/embed/**[CHANGE HERE WITH YOUR YOUTUBE VIDEO ID]**?autoplay=1&controls=0&showinfo=0&autohide=1">
  </iframe>
</div>
 1
Author: Bay,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-10-18 16:36:08