Jump to content

Recommended Posts

Posted

I've written a textformatter module for transforming SoundCloud URLs into SoundCloud widgets. It is customizable, so the user is able to select color, auto-play and comment visibility options. 

Being based on the YouTube/Vimeo textformatter by Ryan, it is working in the same way.

I hope you like it.

bildschirmfoto2013-09mzsmw.png

bildschirmfoto2013-09v5sr2.png

TextformatterSoundcloudEmbed.module

  • Like 12
  • 1 month later...
Posted (edited)

I gonna try your module & love what you build !

but I get a Fatal error: Call-time pass-by-reference has been removed in /Path/To/modules/TextformatterSoundcloudEmbed.module on line 117

I've changed the format() methode, now it seems to works.

public function format(&$str) {
    $str = $this->embedSoundcloud($str);
}

ps, can't get it working. 

Edited by Martijn Geerts
  • Like 1
Posted

Hi Martijn,

thanks for your feedback and your interest in my SoundCloud module. Can you please change line 116-137 in the module file to the following and tell me, whether it works or not?

public function format(&$str) {
		$str = $this->embedSoundcloud($str);
	}
	
	protected function embedSoundcloud($str) {
		if (strpos($str, '://soundcloud.com/') === false) return;

		
		$regex = '/.*?((?:http|https)(?::\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))/is';	//Url
		preg_match_all($regex, $str, $matches);		
		//echo var_dump($matches);
		foreach ($matches[1] as $match) {
			if (strpos($match, '://soundcloud.com/') === false) continue;
			$match = str_replace("</p>", "", $match);
			$soundcloudId = str_replace("https", "http", $match);
			$oembedURL = "http://soundcloud.com/oembed?".$this->getOembedParameters()."format=json&url=".urlencode($match);
			$embedCode = $this->getEmbedCode($oembedURL, $soundcloudId);
			
			if ($embedCode) $str = str_replace($match, $embedCode, $str);
		}
		//exit;
		return $str;
	} 
Posted

Doesn't seem to work for me. But I can just be me, cause I not sure which url to use. It's just trial and error.

For me the whole SoundCloud is a little bit confusing. 

For audio I now use audio.js. Works great, i'm sorry.

Posted

I had a problem with this module before I discovered this thread, getting the same error Martijn Geerts noted above.

After taking a look at Ryan's original Vimeo/YouTube module, I changed line 117 from:

$this->embedSoundcloud(&$str);

to:

$this->embedSoundcloud($str);

removing the "&" in red before "$str" in the first example above. 

Now it works as expected, including multiple embeds on a single page.

However, there is one anomaly: unlike the Vimeo/YouTube module, this Soundcloud module is sensitive to its order among other TextFormatters (in Edit Field --> Field Type Details --> Text Formatters).

The SoundCloud module won't embed when Markdown Extra module follows it, but embeds OK when Markdown precedes it.

I hope that makes sense, thanks for your work on this, Marvin!

  • Like 2
  • 2 years later...
Posted

Once installed, I cannot edit the settings PW says "Can't uninstall module - Module is not already installed" that's just plain weird.

Not sure if it's a PW bug or module bug.

  • 1 month later...
Posted

Anyone using this module successfully with PW 2.7.x? I've had no luck so far getting PW to even recognize that it's available to install.

Edit: Installed a completely different module, and afterwards, this one magically appeared as available to install.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...