How to use oembed for Soundcloud
-
Hi there!
At my blog posts I frequently embed Soundcloud-tracks (as a spoken blog post). I recently remove all iframes from my website and now I use oembed.
For Soundcloud it doesn’t work out well. I cannot resize the track.
Example:
<iframe src=”https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/335694665&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false” width=”100%” height=”166″ frameborder=”no” scrolling=”no”></iframe>I tried this:
[embed width="100%" height="166"]https://soundcloud.com/jessievanloon/ep7-niet-beginnen-met-blogtitel&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false[/embed]The result is a tiny sort of thumbnail. You can see it at https://businessblogschool.nl/blogtitel-als-eerste-schrijven-werkt-niet/. If I don’t define width and height I get a big square picture. But as you can see, with width at 100% it works neither…
What’s going wrong? Thanks in advance.
JessieThe page I need help with: [log in to see the link]
-
I would not define the width or height of the embed, but rather wrap the embed in a container:
HTML:
<div class="jkl"> [embed]https://yoursite.com/yourfile/[/embed] </div>CSS:
.jkl iframe { max-width:750px; width:100%; height:160px; }The SoundCloud widget loads an iframe.
Above is a very basic example of a method to fit the embed in a container.
Additional CSS can be added for positioning the div on the page, including varied screen widths.
Tip: The embed is fit into it’s container. Defining the container size seems to resolve this.
There are also several console errors on your site directly related to this content. Such errors can cause site issues that are difficult to pinpoint. Please also ask SoundCloud about this.
Thank you, I’m gonna try.
Maybe working with a Soundcloud plugin is a work-around for both the iframe as the errors?
Where did you discover these errors?
The topic ‘How to use oembed for Soundcloud’ is closed to new replies.