Hi,
I am working on a system where I need multiple uPnP servers to connect and play music on different devices simultaneously. It is not multi stream as I need different playlists playing on different devices. I wanted to create a simple desktop app that allows me to communicate with these servers and send the basic media player commands. I can do this easily with WebSocket for one instance but I cannot figure out how to do this for multiple instances since there is no information on how to connect to a particular instance of Monkey Media via server Ip and port. As such I am a bit lost and would appreciate any info that would clear things out for me.
Multiple instances ws socket
Moderators: jiri, drakinite, Addon Administrators
Re: Multiple instances ws socket
Hi,
Are you referring to WMP capabilities to Cast Library on multiple devices and have them listed as different control points?
Are you referring to WMP capabilities to Cast Library on multiple devices and have them listed as different control points?
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
-
- Posts: 10
- Joined: Tue Jul 02, 2024 3:31 am
Re: Multiple instances ws socket
Hi,
The WMP capability from what I am aware can only play the same thing on multiple cast devices. What I want to achieve is to play different files/playlists on different devices so yes I want each device as a different control point essentially.
The WMP capability from what I am aware can only play the same thing on multiple cast devices. What I want to achieve is to play different files/playlists on different devices so yes I want each device as a different control point essentially.
Re: Multiple instances ws socket
Hi,
unfortunately that is not possible from MM side you can cast single track to multiple devices at same time, but not mutiple files to mutiple devices. You can use devices to access MM DLNA/UPnP server to play different music.
unfortunately that is not possible from MM side you can cast single track to multiple devices at same time, but not mutiple files to mutiple devices. You can use devices to access MM DLNA/UPnP server to play different music.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
-
- Posts: 10
- Joined: Tue Jul 02, 2024 3:31 am
Re: Multiple instances ws socket
No issues, my current workaround for this is that I use multiple instances of MM at the same time with each instance acting as a different access point. This works I can confirm. The issue is I want to communicate to these multiple instances but from all documentation I have inferred that you cannot communicate with a specific instance of MM. The ws socket and other methods simply communicate with the first instance of MM launched. Hence I wanted to ask is there maybe anything I have missed that will allow me to communicate with specific instances given that each instance is sharing media at a different port address.
Re: Multiple instances ws socket
Hi,
Have you tried to rename MM Server names?
I've tried in MMA and even they have same name I can manually add multiple servers adn access them at same time.
Have you tried to rename MM Server names?
I've tried in MMA and even they have same name I can manually add multiple servers adn access them at same time.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
-
- Posts: 10
- Joined: Tue Jul 02, 2024 3:31 am
Re: Multiple instances ws socket
Ill try it out but a bit unsure how that helps for example, this is my JS script to connect to the MM:
similarly here's the python script to achieve the same:
In both these scripts there is no field to connect to a particular MM server via IP/Port or server name. So even if I have multiple servers with different names and IPs in unable to connect to that server specifically. Hence I wanted to know if theres any way to communicate and send commands to a MM server specifically.
Also to clarify, the problem is not setting up multiple servers/access points in MM but to communicate with them from an external application.
Code: Select all
async function getWebSocketDebuggerUrl() {
try {
// Fetch the list of open pages from the browser
const response = await axios.get('http://localhost:9222/json');
const pages = response.data;
// Find the page with the URL 'file:///mainwindow.html'
const mainPage = pages.find(page => page.url === 'file:///mainwindow.html');
if (mainPage) {
// Return the WebSocket debugger URL
return mainPage.webSocketDebuggerUrl;
} else {
throw new Error("Main window page not found.");
}
} catch (error) {
console.error('Error fetching WebSocket debugger URL:', error);
}
}
var wsUrl = await getWebSocketDebuggerUrl();
console.log(wsUrl);
var ws = new WebSocket(wsUrl);
//Further script to send commands on open close error etc
Code: Select all
import win32com.client
# Create a COM object for MediaMonkey
SDB = win32com.client.Dispatch("SongsDB5.SDBApplication")
Also to clarify, the problem is not setting up multiple servers/access points in MM but to communicate with them from an external application.
Re: Multiple instances ws socket
Hi,
see [MM install folder]/sampleScripts/remoteControl
This way you can communicate with different servers [different ip port] from an external application.
see [MM install folder]/sampleScripts/remoteControl
Code: Select all
/*
This demonstrates how POST request to our media server (see IP:Port in Options > Media Sharing)
catched bellow to start playing
Currently it accepts only POST requests including MMCustomRequest in the request header and valid JSON as request body
The test request available at: https://reqbin.com/uw0qc1ma
POST / HTTP/1.1
Host: 127.0.0.1
MMCustomRequest: true
Content-Type: application/json
Content-Length: 92
{
"target":"remoteMMControlTestScript",
"clientID":"remoteTestClient",
"command":"play"
}
*/
app.listen(app, 'remoteRequest', (r) => {
var content = JSON.parse(r.requestBody);
if (content.target == 'remoteMMControlTestScript' && content.clientID == 'remoteTestClient') {
if (content.command == 'play') {
if (app.player.entriesCount > 0) {
r.asyncResult = true;
app.player.playAsync().then(() => {
var track = app.player.getCurrentTrack();
if (track)
r.responseBody = 'Playback of track ' + track.summary + ' started';
else
r.responseBody = 'Playback started';
});
} else {
r.responseBody = 'No track in \'Playing\' list';
}
}
}
});