api-play button control code
I have managed to embed my score(s) in my site using an iframe. Thank you for this feature.
I would like to capture the play button functionality so that I can make an alternate button outside of the embedded content. (this is so that user could flip through a playlist of scores without having to re-engage the native musescore playbutton for each score) / alternatively- autoplay functionality for scores?
If I could gain the code from you that is the play button only, that would assist me with this question.
Thanks!
Scott
Comments
This question might be better suited for https://musescore.com/groups/improving-musescore-com/
A little bit of looking around with my browser inspector and it seems that within the iFrame, running
jsmuseInstance.playToggle()
works perfectly for driving the play/pause buttonIn reply to A little bit of looking… by jeetee
Thank you so much. : I don't know how to place this?
In reply to A little bit of looking… by jeetee
Is this javascript? Would i insert this into the embed code line from the musescore share link?
Or independently as a jsmuseInstance.playToggle() etc?
Thanks!
In reply to Is this javascript? Would i… by scottwarren
Yes, it is JavaScript. Sorry, I kind of assumed someone talking about creating a play button outside of the embedded score would have some notion of the scripting involved.
If I remember correctly you should be able to add an id to the embed element; then from your parent page use that to access the document within for which the given code indeed works on global document scope. I'm not sure if this is still allowed in modern browsers, given that it can be considered as cross-domain scripting.
In reply to Yes, it is JavaScript. Sorry… by jeetee
Hi guys,
I asked this question long ago.
I appreciate the replies given so far!
Apparently Jeetee was correct in Nov-18 re"cross-domain scripting".
All I'm trying to do is run play/pause from my own buttons, so that I can track user achievements. I want to gamify.
Prior to my initial post, I had this working.
Then the cross-domain scripting.rules must have kicked in.
I have now returned to the old buttons, and discovered that they actually still work -if- the iframe has literally been interacted with by the user actually clicking, even an inactive portion within the iframe.
After that, my buttons work.
So, I think I now have a more informed question. The inspector says that cookies have not been defined as "same site" "secure" or "LAX". I assume these are cookies on your end, as my site uses none.
I know little about MuseScore's cookies, but would be possible to provide a cookie that would allow this specific iteraction from my site?
It would solve my whole music-ed flow!
Thanks much!
Scott
In reply to Hi guys, I asked this… by scottwarren
Ps -
So now I am discovering that these embeds are taking forever to load, And even besides the above,
inspector is constantly warning about "cross-domain cookies". In particular, "waiting for mc.yanex..."
Sometimes my embeds hang forever, with the "waiting for yanex" info in Chrome.
I read other "yanex" threads, and don't understanf why an embed should be involved with it.
So, it seems that MS cookies are really in the way. Can this be fixed?
Thanks,
Scott5
In reply to Ps - So now I am discovering… by scottwarren
I'm not sure you fully grasp what an embed is; it is nothing more than a mechanism to allow one (parent) webpage to load a different webpage in a predestined area.
And that webpage that is loaded is the normal score webpage from musescore.com, which includes all its normal tracking and cookies and statistics (which is what yanex is, a russian google-stats competitor)
In reply to I'm not sure you fully grasp… by jeetee
No jeetee,
I actually DO unerstand an Iframe now.
Thanks for your confirming education!
I have since found some "my bad's in my code"
BUT, my post.
is mainly in sincere attempt
to workaround "cross-domain scripting rules"
- which you had pointed out over 2 years ago.
All I want, is to allow the play/pause toggle function, from my Domain.
3 years ago, I found some code on StackOverflow, that worked - until browser-rules kicked in.
Now, I have managed to reconstruct that code, (blindly) to still work! Yay!
Only prob, is (like a musical "pickup", I have to -for some reason - trick my users to manually
click the iframe object first,
or the transport freezes -in place- without playing.
If only, that step could be avoided!
Where I began discussion of "cookies", is that the CDS rules seem to be patrolled
in browser functions, BY "cookies". (Going by inspector warnings and complaints)
I cannot takeover your site domain, by mine, - thankfully!
Just hoping for a way to allow my mere buttons to toggle play/Pause, on Your end.
Thanks for you reply!
Scott
In reply to No jeetee, I actually DO… by scottwarren
PS,
what I am working on. is revolutionary (I own a US patent on it)
A Music-Ed distance learning site.\
I seek to gamify it, to motivate DL Edu for future generations
-and to educate Educators in this field, as a tool -plugin.
In reply to PS, what I am working on… by scottwarren
MuseScore, is my choice. And gratitude, for helping make this digitally happen!
In reply to MuseScore, is my choice. And… by scottwarren
(The idea of a Distance Learning Site is, of course,
not Revolutionary)
But my Method, IS!
In reply to (The idea of a Distance… by scottwarren
(Yet, Truth be told,
my Dad, Steve Warren was the first! -DL Educator.
He invented -Speed Reading/ Disance Learning, Held a US Patent,- was endorsed by JFK)
and died in 1981, before searchable on the net)
Pleae help me with these menial workarounds,
Thanks!
In reply to (Yet, Truth be told, my Dad,… by scottwarren
Sorry!,
My last 4 comments were irrelevant to your Forum.
Moderator,
please remove them.
Apologies,
Thanks!
In reply to Sorry!, My last 4 comments… by scottwarren
No one is likely to remove them. People are more tolerant of straying from the topic in the forums than they are in the issue tracker. I find your comments fascinating.
In reply to No one is likely to remove… by mike320
Thank you mike320!
I am passionate about what I'm doing, and get carried away sometimes.
Appreciate your comment!
Scott Warren
In reply to No jeetee, I actually DO… by scottwarren
As you by now are likely aware (from your other topic as well); nobody in these forums can do/change anything about the .com online score sharing platform. It is run by a different entity/team.
You say your current code works as long as the user puts the focus into the iframe first. Isn't that perhaps something you could trigger somehow as well. Something in the line of document.getElementById("myIframe").focus() ?
In reply to As you by now are likely… by jeetee
Thank you
jeetee !!
I FOUND IT!
Somehow the allow="autoplay; parameter was missing!
Now I can move forward!
(I was hungup on the Browser "Cross Domain Rules", thinking I had to defeat them).
That's all it was.
So I now understand that there is a .org/and .com for musescore,
and what Ithink you guys are saying, is that you have no control of "embed" functionality?
-Why I see very little related discussion here?-
Anyway, I am a happy camper, and your effort has helped make that so.
Scott
In reply to Thank you jeetee !! I FOUND… by scottwarren
That is in the Share > Embed dialog on a score on musescore.com
In reply to That is in the <iframe… by Jojo-Schmitz
i Know! Jojo, but somehow that parameter got ommitted from my prototype. upon modifications
For others, good to know, - but when I began this thread, the Browser CrossDomainScripting rules had just begun enforced,
And so I got lost in that desert, with respect to Jeetee's accurate disclaimer initially.
Sorry for my bad.
Scott