PHP Classes

PHP Mixcloud Player: Embed player of music hosted in Mixcloud

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 106 All time: 9,679 This week: 488Up
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
Age: 36
All time rank: 4394232 in Germany Germany
Week rank: 360 Up12 in Germany Germany Up

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  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:106
This week:0
All time:9,679
This week:488Up