PHP Classes

PHP Mixcloud Player: Embed player of music hosted in Mixcloud

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 107 All time: 9,695 This week: 65Up
Version License PHP version Categories
mixcloud-player 2.0GNU General Publi...5HTML, PHP 5, Web services, Audio
Description 

Author

This class fetches information from the Music streaming service Mixcloud to embed in a Web site.

It sends HTTP requests to the Mixcloud API endpoint to retrieve users' information, playlists, or Cloudcast.

The class generates the HTML Iframe code to embed Mixcloud players on a website.

The class supports options to fetch the Mixcloud dark mode player. It is possible to adjust the iframe size in width and height.

Mixcloud only provides the iframe method to embed a music player in another site. So there is no other way to access the audio stream.

Picture of Lukas Bonsch
Name: Lukas Bonsch <contact>
Classes: 1 package by
Country: Germany Germany

Example

<?php
require_once("class_mixcloud_player.php");

//using the mixcloud api reference user spartacus
//also see https://www.mixcloud.com/developers/ and https://www.mixcloud.com/spartacus/
$mixcloud = new mixcloud_player("spartacus");

echo
"show Userdata:";
echo
$mixcloud->getUser_HTML();
echo
"<br>-------------------------<br>";
echo
"show the latest upload (get's the embed code via api)";

echo
$mixcloud->get_latest_player();
echo
"-------------------------<br>";
echo
"for the latest upload there is also the to string option:";
echo
$mixcloud;
echo
"-------------------------<br>";
echo
"get specific upload via offset (this returns the third latest upload)";
echo
$mixcloud->get_player(3);
echo
"-------------------------<br>";
echo
"GET ALL THE UPLOADS";
$i = 1;
while(
$i < $mixcloud->get_count())
{
    echo
$mixcloud->get_player($i);
   
$i++;
}

echo
"-------------------------<br>";
echo
"DARK MODE";
$mixcloud_dark = new mixcloud_player("spartacus");
$mixcloud_dark->setPlayerstyle(true);
echo
$mixcloud_dark->get_latest_player();

echo
"-------------------------<br>";
echo
"HIDE COVER / different height";
$mixcloud_other = new mixcloud_player("spartacus");
$mixcloud_other->setPlayerstyle(true, false);
echo
$mixcloud_other->get_latest_player("100%", "400px");
echo
"-------------------------<br>";
echo
"specific show from user by title";
$mixcloud_show = new mixcloud_player("spartacus");
echo
$mixcloud_show->getShow("Party Time");
echo
"-------------------------<br>";
echo
"playlist example with playlist title";
//using the mixcloud api reference user spartacus
//using the playlist "Save for a rainy day"
//also see https://www.mixcloud.com/developers/ and https://www.mixcloud.com/spartacus/playlists/save-for-a-rainy-day/

$mixcloudpl = new mixcloud_player("spartacus");
$mixcloudpl->setPlaylist("Save for a rainy day");


echo
$mixcloudpl->get_latest_player();
echo
"-------------------------<br>";
//for the latest upload there is also the to string option:
echo $mixcloudpl;
echo
"-------------------------<br>";
//get specific upload via offset (this returns the third latest upload)
echo $mixcloudpl->get_player(3);

?>


  Files folder image Files (4)  
File Role Description
Plain text file class_mixcloud_player.php Class the class
Plain text file class_mixcloud_player_1.1.php Class the original class from 2015
Plain text file class_mixcloud_player_1.5.php Class updated version fom 2017
Accessible without login Plain text file example.php Example example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:107
This week:0
All time:9,695
This week:65Up