Edzelf / Esp-radio

Internet radio based on Esp8266 and VS1053.
MIT License
622 stars 201 forks source link

Play music from cloud storage #156

Open FreeElement opened 5 years ago

FreeElement commented 5 years ago

I would like to see in your project an analogue of the functionality: Music Player for Google Drive. To play music from the cloud, flash cards will no longer be needed in the future. Or if it takes a lot of your time, tell me where to fix the code, I'll take it on myself and for this I will learn the programming language.

This code I ran on PHPStorm:

`<?php

require_once 'libs/autoload.php'; define('ACCESS_TOKEN','hjhkklkUYUIIOOkkllbnnmGHYRD'); use Yandex\Disk\DiskClient; $disk = new DiskClient(); //Install the received token $disk->setAccessToken(ACCESS_TOKEN);

$path = 'Music/001.mp3'; $destination = 'C:'; $name = 'downloaded_file.mp3'; if ($disk->downloadFile($path, $destination, $name)) { echo 'File "' . $path . '" downloaded in ' . $destination . $name; }`

It works, but just downloads the file from Yandex Disk to your local computer. Is there any way to integrate it into your project and stream it to playback?

Edzelf commented 5 years ago

Main problem is: how to read from a google drive without having Windows. It is probably easier to install a shoutcast server on a Windows machine that reads from the Google drive.

FreeElement commented 5 years ago

There is a plugin MyClouds to listen to music from the clouds on the player AIMP: http://www.aimp.ru/forum/index.php?topic=58962.0

I asked the developer about the principle of its action.

I quote his answer: "in the case of MP3 you can listen to it as a regular Internet radio station. The difference between clouds and Internet radio stations is that the link to the file is temporary and it does not live long. In order to get it, you need to log in." I am not familiar with the technology of data transmission over networks and this information has not clarified much for me. But if the analogy: AIMP and ESP-radio it players, differs only in the software environment code execution. AIMP somehow plays files from the cloud. Maybe it's all about Windows... But most likely in aimp cloud storage is mounted as a disk, scanned directory with music. On the received links the files are read using the WebDAV Protocol.

I understand correctly-ESP-radio (ESP8266) is a client and makes a request to the streaming server, and that on request already gives the mp3 stream?

Edzelf commented 5 years ago

Yes the server delivers a stream or a file. The contents is the same. So if you can read from a Google drive in a microcontroller environment, it will work.