Did you know Bot Libre also provides free hosted forums for your own website or mobile app?
Self, AIML, and scripting

making a web-radio player?

by ronxtcdabass posted 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: 898, today: 0, week: 7, month: 59

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: 890, today: 1, week: 6, month: 51

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: 906, today: 1, week: 5, month: 56

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: 881, today: 0, week: 6, month: 54

Id: 43374659
Tags: how to, music, radio
Posted: Jun 13 2022, 16:30
Replies: 3
Views: 1022, today: 1, week: 4, month: 82
0 0 0.0/5