Atualização para o nosso serviço comercial de Bot Libre for Business por apenas r$4,99 por mês
Self, AIML, and scripting

making a web-radio player?

por ronxtcdabass postado Jun 13 2022, 16:30

Hello!

can someone help me with this?

i tried to modify the "musicplayer" script for playing my favoriteradio station, but what must i do now?

where must i put this to let my bot play?

(english is not so easy for me. my mothertongue is german.)

 


greeting: Hello there. wanna hear some of my favorite  stations?  default: Sorry, but I do not understand. try something other. play #play_music play music "

What radio station would you like?:

 

 

 

" label: #play_music keywords: music audio play start GlobalBeats FM - Green Channel playing GlobalBeats FM command: { type: "music", cmd: "play", genre: "GlobalBeats FM", url: "http://gbs03.de:7120" } poses: dancing Suburbs of Goa: [SomaFM] playing Suburbs of Goa command: { type: "music", cmd: "play", genre: "Suburbs of Goa", url: "http://ice1.somafm.com/suburbsofgoa-128-mp3" } poses: dancing Babaganousha Radio playing Babaganousha Radio command: { type: "music", cmd: "play", genre: "Babaganousha Radio", url: "http://babaganousha.net:8000" } poses: dancing Hirschmilch psytrance playing Hirschmilch psytrance command: { type: "music", cmd: "play", genre: "Hirschmilch psytrance", url: "http://hirschmilch.de:7000/psytrance.mp3" } poses: dancing Hirschmilch progressive playing Hirschmilch progressive command: { type: "music", cmd: "play", genre: "Hirschmilch progressive", url: "http://hirschmilch.de:7000/progressive.mp3" } poses: dancing pause paused... keywords: pause stop command: { type: "music", cmd: "pause", url: "https://rfcmedia.streamguys1.com/MusicPulse.mp3" } poses: default


by admin posted Jun 13 2022, 17:24
Please include a link to the musicplayer script you are trying to modify.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 914, today: 1, week: 12, month: 75

by ronxtcdabass posted Jun 20 2022, 12:11

The idea comes from:

https://www.botlibre.com/script?id=36415757   and

https://www.botlibre.com/script?id=36393269 

in the example it works only with this website.

In the code from the first link are only entries to ***.mp3 so i tried with other files and it worked, but not with radiostreams...


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 901, today: 0, week: 6, month: 62

by admin posted Jun 21 2022, 8:53

So the bot in this script uses "commands" in Bot Libre to pass back the audio commands to the client.

Your web or mobile client needs to process these commands to play the audio.

In the example website it uses some JavaScript code to process the audio command, you need this code for you bot to play audio.

var audio = new Audio();
function PlayMusic() {
this.updateAvatar = function(response) {
if (response.command != null) {
var command = JSON.parse(response.command);
console.log(command);
if (command.cmd == "play") {
audio.pause();
audio.src = command.url;
audio.play();
} else if (command.cmd == "pause") {
audio.pause();
}
}
}
}

web.game = new PlayMusic();

Thumbs up: 1, thumbs down: 0, stars: 5.0
Views: 918, today: 0, week: 10, month: 68

by ronxtcdabass posted Jun 21 2022, 12:55

WOW!!!!

 

thank you for the fast help!

it works...

edited: it works in my html file at my PC but online at my webspace works only [Soma FM] ...

my testpage: Test


Updated: Jun 21 2022, 14:47
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 889, today: 0, week: 6, month: 62

Id: 43374659
Tags: how to, music, radio
Postado: Jun 13 2022, 16:30
Respostas: 3
Pontos de vista: 1036, hoje: 2, semana: 11, mês: 96
0 0 0.0/5