Skip to content
Related Articles

Related Articles

Google AMP amp-soundcloud
  • Last Updated : 25 Oct, 2020

 

SoundCloud is an online audio distributing and sharing website the music and playlist can be embedded in an AMP HTML page using amp-soundcloud component which can be used to have your favorite songs or SoundCloud playlist in your website.

SoundCloud link : https://soundcloud.com/

Required Scripts: Importing the amp-soundcloud component 

HTML



filter_none

edit
close

play_arrow

link
brightness_4
code

<script async custom-element="amp-soundcloud" 
</script>

chevron_right


Attribute:

  • data-playlistid: Needs to be specified if data-trackid not specified. This is an ID of a playlist in SoundCloud.
  • data-trackid: Needs to be specified if data-playlistid is not specified. This is an ID of a track in SoundCloud.
  • data-visual: If set as true full width visual mode is set.
  • data-color: It sets a specific color which overrides the default value. Color should be specified in a hexadecimal number.

Example:

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!doctype html>
<html ⚡>
  
<head>
    <meta charset="utf-8">
    <title>Google AMP amp-soundcloud</title>
  
    <script async src=
    </script>
      
    <!--Import the `amp-soundcloud` component.-->
    <script async custom-element="amp-soundcloud" 
    </script>
      
    <link rel="canonical" href=
  
    <meta name="viewport" content=
"width=device-width,minimum-scale=1,initial-scale=1">
  
    <style amp-boilerplate>
        body {
            -webkit-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
              
            -moz-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
              
            -ms-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
              
            animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
        }
  
        @-webkit-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-moz-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-ms-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-o-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
    </style>
    <noscript>
        <style amp-boilerplate>
            body {
                -webkit-animation: none;
                -moz-animation: none;
                -ms-animation: none;
                animation: none
            }
        </style>
    </noscript>
</head>
  
<body>
    <!--fixed-height layout-->
    <amp-soundcloud height="200" 
        layout="fixed-height" 
        data-trackid="89299804">
    </amp-soundcloud>
  
    <!--data-color mentioned.-->
    <amp-soundcloud height="200" 
        layout="fixed-height" 
        data-trackid="89299804" 
        data-color="448AFF">
    </amp-soundcloud>
      
    <!-- allows embedding Soundcloud playlist-->
    <amp-soundcloud height="350" 
        layout="fixed-height" 
        data-playlistid="331919427" 
        data-visual="true">
    </amp-soundcloud>
</body>
  
</html>

chevron_right


Output :

My Personal Notes arrow_drop_up
Recommended Articles
Page :