在尝试播放YouTube电影后,我试图将推荐视频设置为该 channel 的视频,但是我写错了。
这是我的iframe逻辑:
<iframe
src="https://www.youtube.com/embed/VIDEO_ID?listType=user_uploads&list=CHANNEL_ID?autoplay=1"
></iframe>
这是真实的代码:
<iframe
src="https://www.youtube.com/embed/LKKQpX5ucGk?listType=user_uploads&list=UC-k6oG4r4vQjeoMZlEHzQmw?autoplay=1"
></iframe>
最佳答案
您可以通过向您的src中添加rel=0
来限制相关视频来自同一 channel
以下有您想要的效果
<iframe width="560" height="315" src="https://www.youtube.com/embed/boPZ_0E6X6s?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
关于iframe - 无法播放YouTube视频后正确设置相关视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56055391/