Phần 1 - Cách chèn video youtube vào Blog của bạn nhanh nhất đã hướng dẫn các bạn cách chèn một video youtube vào website - blogspot bằng đoạn code
<iframe WIDTH="560" HEIGHT="315" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/[Video ID]" ></iframe>
Ví dụ chèn video có chiều ngang 700 có code như sau:
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU" ></iframe>
Ví dụ chèn video có chiều ngang 320 có code như sau:
<iframe WIDTH="320" HEIGHT="180" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU" ></iframe>

2. Thuộc tính Liên kết - Related
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?rel=0" > </iframe>Các bạn xem lại 2 video dưới này nhé:
3. Thuộc tính Tự động phát - Autoplay
- Khuyến cáo: không nên dùng, vì sẽ làm người truy cập khó chịu
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?autolay=1&rel=0" > </iframe>Trong đoạn code trên, mình đã kết hợp 2 thuộc tính: ?autolay=1&rel=0
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?showinfo=0" > </iframe>Các bạn xem 2 video dưới này nhé:
5. Thuộc tính Lặp lại - Loop trong video
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?loop=1" > </iframe>
6. Thuộc tính Chú thích - Annotations trong video
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?iv_load_policy=3" > </iframe>7. Thuộc tính Controls
Thuộc tính này cho phép hiển thị hoặc không hiển thị thanh điều khiển của video. Mặc định mỗi video khi chèn vào thì thuộc tính controls=1, để tắt thuộc tính này bạn thêm đoạn code như sau:
<iframe WIDTH="700" HEIGHT="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen src="https://www.youtube.com/embed/4VhwnXgbuGU?controls=0" > </iframe>Các bạn xem ví dụ:
No comments: