Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: playStream not working with execFunction #3895

Closed
Arthur-WhiteCorp opened this issue Apr 1, 2023 · 9 comments · Fixed by #3966
Closed

[Bug]: playStream not working with execFunction #3895

Arthur-WhiteCorp opened this issue Apr 1, 2023 · 9 comments · Fixed by #3966
Assignees
Labels

Comments

@Arthur-WhiteCorp
Copy link

Describe the Bug

When i try to use playStream with execFunction to play audio it does not work.

To Reproduce

my code:
[playStream(macro.args)]
[H: songUrl = json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3")]
[H: execFunction("playStream", songUrl, 0, "all")]

Expected Behaviour

Audio should play.

Screenshots

bug

MapTool Info

I am using version 1.12.2

Desktop

Windows 10 Pro 22H2

Additional Context

No response

@emmebi
Copy link
Collaborator

emmebi commented Apr 2, 2023

Remove the

 [playStream(macro.args)]

at the beginning of your macro.

@Jmr3366
Copy link
Contributor

Jmr3366 commented Apr 7, 2023

I've attempted a few times and this isn't failing for me (LAN connection between two laptops, tested on 1.11.5, 1.12.2, and 1.13.1beta)
Stop Macro:
[h: execFunction("stopSound",json.append("","*"),0,"all")]
Play macro:
[H: songUrl = json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3")]
[H: execFunction("playStream", songUrl, 0, "all")]

@Jmr3366
Copy link
Contributor

Jmr3366 commented Apr 17, 2023

@Phergus I'm not able to duplicate this issue and I believe it was more syntax related. -I believe this should be closed-.

edit: spoke too soon, added examples to duplicate issue, it should be left open

@FullBleed
Copy link

FullBleed commented Apr 17, 2023

I believe that @bubblobill has mentioned this being an issue... even going so far as to create a custom execFunction to work with his music and sound mixer.

https://discord.com/channels/296230822262865920/1009374846788046869/1076418154873487380

@Jmr3366
Copy link
Contributor

Jmr3366 commented Apr 17, 2023

After more testing and as to why there maybe a variety of results
These should not fail and should play for every client
[h: songUrlA = json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3")]
[h: execFunction("playStream", songUrlA, 0, "all")]
or
[h: execFunction("playStream", json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3"), 0, "all")]

This plays on local and fails to play on remote clients (every time on all testing I did)
[h: songUrlA = json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3",1,0.2,0,-1)]
[h: execFunction("playStream", songUrlA, 0, "all")]
and
[h: execFunction("playStream", json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3",1,0.2,0,-1), 0, "all")]
I'm guessing there is some sort of issue around parseing variables passed through parameters in execFunction

@Jmr3366
Copy link
Contributor

Jmr3366 commented Apr 17, 2023

I'm not sure where the root cause is but if you string the JSON it works:
[h: execFunction("playStream", json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3","1","0.2","0","-1"), 0, "all")]
The json being passed into execFunction that is then being parsed for the function execFunction will to run, may not be handling a value correctly.

@FullBleed
Copy link

I'm not sure where the root cause is but if you string the JSON it works: [h: execFunction("playStream", json.append("[]","https://dl.dropboxusercontent.com/s/ir0f5tr3fkdefxs/rainforest_ambience3.mp3","1","0.2","0","-1"), 0, "all")] The json being passed into execFunction that is then being parsed for the function execFunction will to run, may not be handling a value correctly.

I know you're working this one out... but I wonder if this, perchance, is related to this issue with execFunction: #3382

Pinging @kwvanderlinde since he found the other execFunction issue (which may or may not be fixed in 1.12+) ...

@kwvanderlinde kwvanderlinde self-assigned this Apr 18, 2023
@kwvanderlinde
Copy link
Collaborator

Alas it has nothing to do with it and the other issue only applies to 1.11.

I'll start by echoing what Jmr said - I can't reproduce the original issue with only a URL, nor do I see any reason in code for that to be an issue.

As for the issue when other parameters exist, that is due to the second parameter (cycleCount) being required to be an integer. But we aren't careful to keep the integer-ness when sending the arguments to the client, so the 1 gets turned into 1.0 and gets rejected on the client. This should be an easy fix, assuming we don't have any code expected that particular behaviour for some reason...

@kwvanderlinde
Copy link
Collaborator

I'll put up a fix, we should be able to get this into 1.13 yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment