public function testEmbed() { $id = static::id(); $ripple = new Ripple(); $this->assertSame(self::URL_EMBED . $id, $ripple->embed('SoundCloud', $id)); $ripple = new Ripple(); $ripple->setEmbedParams(['SoundCloud' => '?auto_play=true']); $this->assertSame(self::URL_EMBED . $id . '?auto_play=true', $ripple->embed('SoundCloud', $id)); }
public function testEmbed() { $id = static::id(); $ripple = new Ripple(); $this->assertSame(self::URL_EMBED . $id, $ripple->embed('Vimeo', $id)); $ripple = new Ripple(); $ripple->setEmbedParams(['Vimeo' => '?autoplay=1']); $this->assertSame(self::URL_EMBED . $id . '?autoplay=1', $ripple->embed('Vimeo', $id)); }
public function testEmbed() { $id = static::id(); $ripple = new Ripple(); $this->assertSame(self::URL_EMBED . $id . '/', $ripple->embed('Bandcamp', $id)); $ripple = new Ripple(); $ripple->setEmbedParams(['Bandcamp' => 'size=large/']); $this->assertSame(self::URL_EMBED . $id . '/size=large/', $ripple->embed('Bandcamp', $id)); }
public function testProviders() { $this->assertSame(['Bandcamp', 'SoundCloud', 'Vimeo', 'YouTube'], Ripple::providers()); }
/** * @param string $url * @param string $expected * @dataProvider validUrlPatternProvider */ public function testValidUrlPattern($url, $expected) { $ripple = new Ripple($url); $this->assertSame($expected, $ripple->isValidUrl()); }
<?php require __DIR__ . '/../vendor/autoload.php'; use jamband\ripple\Ripple; use Goutte\Client; // $url = 'https://folkadelphia.bandcamp.com/track/facing-west'; // $url = 'https://soundcloud.com/the-staves/pay-us-no-mind'; // $url = 'https://vimeo.com/67320034'; $url = 'https://www.youtube.com/watch?v=MBlpfXLQLvU'; $ripple = new Ripple($url); var_dump($ripple->provider()); // YouTube var_dump($ripple->isValidUrl()); // true $ripple->request(new Client()); var_dump($ripple->id()); // MBlpfXLQLvU var_dump($ripple->title()); // The Staves - The Motherlode (Official Video) var_dump($ripple->image()); // https://i.ytimg.com/vi/MBlpfXLQLvU/hqdefault.jpg var_dump($ripple->embed()); // https://www.youtube.com/embed/MBlpfXLQLvU
use jamband\ripple\Ripple; use Goutte\Client; // $url = 'https://folkadelphia.bandcamp.com/track/facing-west'; $url = 'https://soundcloud.com/the-staves/pay-us-no-mind'; // $url = 'https://vimeo.com/67320034'; // $url = 'https://www.youtube.com/watch?v=MBlpfXLQLvU'; // simple (set provider name and ID) $ripple = new Ripple(); var_dump($ripple->embed('YouTube', 'MBlpfXLQLvU')); // https://www.youtube.com/embed/MBlpfXLQLvU // append parameter $ripple->setEmbedParams(['YouTube' => '?autoplay=1']); var_dump($ripple->embed('YouTube', 'MBlpfXLQLvU')); // https://www.youtube.com/embed/MBlpfXLQLvU?autoplay=1 // from track url $ripple = new Ripple($url); $ripple->request(new Client()); var_dump($ripple->embed()); // https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/42854561 // append parameter $ripple->setEmbedParams(['YouTube' => '?autoplay=1', 'Vimeo' => '?autoplay=1', 'SoundCloud' => '?auto_play=true&show_comments=false&visual=true', 'Bandcamp' => 'size=large/']); $embed = $ripple->embed(); var_dump($embed); // https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/42854561?auto_play=true&show_comments=false&visual=true ?> <!-- embed HTML --> <iframe width="300" height="300" src="<?php echo $embed; ?> " frameborder="0" allowfullscreen></iframe>