Divinum Fiat
Well-known member
I'd like to publish my podcasts in my posts, is this possible with XF?
You can get a free sound cloud account which will let you host 2 hours worth of tracks. You can then link those into your posts with a custom BBCode to pull the html5 player into the post.
I do this when posting links to my mixes on my site
View attachment 38495
Yes, I had to change it to use the html5 player.Did your Soundcloud change? Mine doesn't work on my site any more. Maybe a change to the way that the BBCode parses?
<?php
class MediaSites_Soundcloud
{
public static function buildEmbed($mediaKey, array $site)
{
$pageHtml = file_get_contents('http://soundcloud.com/' . $mediaKey );
if(preg_match('#<meta.+player.swf\?url=.+tracks%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="166" class="html5player" scrolling="no" frameborder="no" src="htt
p://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
elseif(preg_match('#<meta.+player.swf\?url=.+playlists%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="htt
p://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
elseif(preg_match('#<meta.+player.swf\?url=.+users%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="htt
p://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fusers%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
else return '<a href="http://soundcloud.com/' . $mediaKey . '">http://soundcloud.com/' . $mediaKey . '</a>';
}
}
Yep:So you had to create a Soundcloud php file and put it in your MediaSites directory?
<?php
class MediaSites_Soundcloud
{
public static function buildEmbed($mediaKey, array $site)
{
$pageHtml = file_get_contents( 'http://' . $mediaKey );
if(preg_match('#<meta.+player.swf\?url=.+tracks%2F(?P<scid>[0-9]+)#i', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="166" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
elseif(preg_match('#<meta.+player.swf\?url=.+playlists%2F(?P<scid>[0-9]+)#i', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
elseif(preg_match('#<meta.+player.swf\?url=.+users%2F(?P<scid>[0-9]+)#i', $pageHtml, $match))
{
$embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fusers%2F__MEDIAKEY__&show_artwork=true"></iframe>';
$finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
return $finalHtml;
}
else return '<a href="http://' . $mediaKey . '">http://' . $mediaKey . '</a>';
}
}
lol - it was hidden deep in the resources LOLI knew I'd seen something!
hmmm - sounds interesting! I'd certainly be interestedI also have an mp3 player that offloads the files when not playing so that none of the files actually load on page load...when you click the container for the song the audio file is loaded into that instance of the player container...
I have to run out but when I get back I will look it up here on my end....if you are interested shoot me a convo titled MP3 with a link to this thread in the body of it to remind me when i sit down after getting back home and maybe I will find it.
#soundcloud\.com/(?P<id>([a-z0-9-_]+/[a-z0-9-_]+/[a-z0-9-_]+)|[a-z0-9-_]+/[a-z0-9-_]+)#si
We use essential cookies to make this site work, and optional cookies to enhance your experience.