Open In App

Google AMP amp-soundcloud

Last Updated : 25 Oct, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

 

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




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


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




<!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>


Output :



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads