Happy New Year 2024 to all our members and visitors! Our Forum is Now Back Online After Some Critical Upgrade- We Apologize for the inaccessibility Period! Thank You all. CORONAVIRUS safety tips from Admin! 1. Watch your hands with running water 2. Dont cough in your hands 3. Keep distance from people 4. Stay indoor if neccessary!! Stay safe !!! Dear Members,Do you know that naijacrux is fully programmed to serve you better, Do you know that you can share your favorite post on naijacrux with friends on twitter,facebook, googleplus,myspace and many more! To share post on naijacrux with friends and family on twitter, facebook,googleplus,myspace,and many more, scroll to the down page of the post, Click on the Social Icon You Want To Share On To Share.


Author Topic: How to Embed YouTube as an Audio Player  (Read 2756 times)

0 Members and 1 Guest are viewing this topic.

Offline newspostng

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1595
  • Karma: +0/-0
How to Embed YouTube as an Audio Player
« on: December 23, 2016, 09:50:12 AM »
Loading...

You can embed any YouTube video in your web pages and visitors on your site will be able to play and pause the video audio with a simple click. With this technique, you can also use a YouTube video as background audio that runs in a loop.


How to Embed YouTube Audio

It takes just one step to embed a YouTube audio. Open any YouTube video and make a note of the YouTube Video ID (a string of 11 characters).

Next copy-paste the code below anywhere on your website and replace VIDEO_ID with actual ID of yourv data-video="VIDEO_ID" 
         data-autoplay="0"         
         data-loop="1"             
         id="youtube-audio">
  </div>
  <script src="https://www.youtube.com/iframe_api"></script>[/greenalert]


There are few other configuration parameters that you can change depending on requirements. For instance, if you set data-autoplay to 1, the audio will begin playing immediately on page load. Likewise, set data-loop to 1 and the audio will play continuously in a never-ending loop until manually stopped.

This internally renders the YouTube video using the IFRAME player and would thus work on both desktop and mobile browsers.

The JavaScript files are hosted on Github while the images are hosted on Imgur. It is recommended that you copy the assets to your own server before deploying on a heavy-traffic website.

YouTube Audio – The Technical Details

We are using the YouTube JavaScript API that renders a regular YouTube player but with the width and height set to 0 pixels. When the user clicks the audio button, it toggles the existing YouTube player state and the video begins to play or pauses.



 

 

how to download youtube videos in small size compressed format

Started by mastercode

Replies: 0
Views: 3360
Last post May 23, 2016, 04:03:51 PM
by mastercode
How To Edit YouTube Video Without Losing Statistics or links

Started by punch

Replies: 0
Views: 16659
Last post August 07, 2019, 05:44:45 AM
by punch
How to Transcribe YouTube Video Files to Text

Started by yungcrux

Replies: 0
Views: 1965
Last post January 16, 2017, 01:14:05 AM
by yungcrux
How to Make a YouTube Video For Beginners

Started by legendguru

Replies: 0
Views: 2096
Last post June 09, 2017, 01:17:49 AM
by legendguru
How to know how much money you can make on Youtube

Started by internet police

Replies: 0
Views: 1869
Last post February 18, 2017, 01:48:58 PM
by internet police