Want player object to keep playing when going to another card

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
donbeck@donbeck.org
Posts: 7
Joined: Tue Mar 09, 2021 6:37 pm
Location: Massachusetts

Want player object to keep playing when going to another card

Post by donbeck@donbeck.org » Sun Apr 04, 2021 9:49 pm

I have a stack for playing MP3s. The first card has a field that has List Behavior checked. This lists all of my MP3s. I also have a player object on the card. When I click on a selection, the player plays that selection. That part works well.

I also have a separate card for each MP3. These cards have notes about each selection. My problem is when a song is playing and I go to the info sheet on that song, the music stops playing, and I want it to keep playing.

I have tried making my player into a group and marking it as “Behave Like a Background.” This allows the music to keep playing, but I don’t want the player object to appear on the info card (right in the middle of my info field.)

Does anyone have any suggestion how I can keep the player playing when I leave the card that the player object is on? Or is there a way to hide the player group on the Info Cards without it being hidden on the Player Card. I hope that I have explained this clearly enough. Any help would be appreciated.

Xero
Posts: 152
Joined: Sat Jun 23, 2018 2:22 pm

Re: Want player object to keep playing when going to another card

Post by Xero » Mon Apr 05, 2021 3:11 am

Is it possible to have only one card do the job for you?
Have the player at the top of the card, and show info below then either:
1. Have the card the same size as the player only. When you 'show' the info, just resize the card to encompass the info box and player, and resize when you want to hide the info.
2. Have the player on a card, and have the info off screen, then resize the card and place the info on the front layer moving it on screen, effectively masking the player, and do the reverse to exit the process. I can't get this to work because the buffer for the player doesn't allow objects in front of the player.
3. Same as 2, but put the player off screen when the info is shown and the card resized.
Hope that makes sense.
XdM

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Want player object to keep playing when going to another card

Post by richmond62 » Mon Apr 05, 2021 7:24 am

I also have a separate card for each MP3.
Personally I'd stick to a single card and have an image the same size as the card for each MP3,
then I'd use show and hide as required.

Here's a demo of that sort of thing.
Attachments
DEMO X.livecode.zip
(13.82 KiB) Downloaded 112 times

donbeck@donbeck.org
Posts: 7
Joined: Tue Mar 09, 2021 6:37 pm
Location: Massachusetts

Re: Want player object to keep playing when going to another card

Post by donbeck@donbeck.org » Mon Apr 05, 2021 3:31 pm

Thank you for your suggestions. They got me thinking further, and I have come up with a fairly simple solution. As mentioned above, when I make the player a group, the music continues playing when I go to other cards with that group on it, but it shows as a big black strip across my notes field. My solution is to put the following in the player card script. It hides the player when going to any of the notes cards, but the music keeps playing, and then it shows the player again when returning to the player card. By doing it this way, when I add songs to my library and add a new notes card, I don't have to add any script on the new card about showing or hiding the player.

Here is the script that I put into my playerDeck card. This is the only card where I want the player object (and now group) to be visible.

on openCard
set the visible of group myGroupedPlayer to true
end openCard

on closeCard
set the visible of group myGroupedPlayer to false
end closeCard

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Want player object to keep playing when going to another card

Post by kdjanz » Mon Apr 05, 2021 7:47 pm

Another way to tackle it might have been to put all the notes into a sub stack of the player that acts like a palette floating above the player. Two different sizes and styles that each are just right for their own purposes.

donbeck@donbeck.org
Posts: 7
Joined: Tue Mar 09, 2021 6:37 pm
Location: Massachusetts

Re: Want player object to keep playing when going to another card

Post by donbeck@donbeck.org » Mon Apr 05, 2021 8:46 pm

Thanks. I might try the sub Stack route later. I hadn't thought of that and haven't used sub Stacks yet.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”