struggling with player

Dave Kilroy dave at applicationinsight.com
Mon Apr 27 04:59:35 EDT 2015


Hi Bill

Just for your interest, I used mobilePlaySoundOnChannel on an iOS app a
couple of years ago and was able to play several audio files at the same
time and change their volume while they all continued to play without
pausing...


   put "word" into tChannelName
   put "now" into tType
   if the environment is "mobile" then
      if (mobileSoundOnChannel(tChannelName) is empty) OR
(mobileSoundOnChannel(tChannelName) is "could not find channel") then
         --
         --make background audio quieter
         if mobileSoundChannelStatus("background") ="playing" then
            put mobileSoundChannelVolume("background") into tVolume
            put (tVolume - 10) into tVolume
            mobileSetSoundChannelVolume "background", tVolume
         end if
         --
         --code to do various things like find the correct audio file
         --make changes to the GUI etc
         --
         --play 'word' audio file
         mobilePlaySoundOnChannel tAudioPath, tChannelName, tType
         --
         --reset GUI & background volume once sound has finished playing
         send "resetFieldBackgroundColor pField" to this stack in tMS
milliseconds
      end if
   end if





Wprothero wrote
> Klaus:
> Ok, it makes sense. I think I’ve got it working now. The slider adjusts
> the volume and all seems ok. One thing is, the 3rd audio clip stops when I
> adjust the slider, but the control still shows it’s running. I then check
> the playRate, even though it isn’t playing and if it is 1 (even in the
> paused mode), I give it a “play” command. This seems to work fine. Also,
> when the stack loses focus, it keeps playing. So, it’s pretty good for
> now.
> 
> It would be really helpful if the LESSONS part of the Livecode site gave
> the correct info for the player. I think I’m going to be using it a lot,.
> 
> Thanks for the help.
> Bill
> 
>> On Apr 26, 2015, at 4:43 PM, Klaus major-k <

> klaus@

> > wrote:
>> 
>> Hi Bill,
>> 
>>> Am 27.04.2015 um 00:04 schrieb William Prothero <

> prothero@

> >:
>>> 
>>> Klaus:
>>> Yeah, just as I posted this, I noticed in the user guide that it was the
>>> playLoudness. I used that and it did change the loudness. However, I’m
>>> still having trouble getting the players to play continuously when I
>>> drag the loudness scroller. I have 3 players going simultaneously and
>>> I’m changing the loudness on 2 of them. There seems to be some kind of
>>> timing problem because if I change the loudness too quickly, one of the
>>> players stops.
>>> 
>>> It also seems pretty cumbersome that there isn’t a “play from start”
>>> command. I will fiddle with the startTime,endTime, and playSelection to
>>> try to get it to rewind to the start. But it seems line basic commands
>>> are quirky to implement. 
>> 
>> See below :-)
>> 
>>> So, to get the player to begin at the start, when it’s somewhere else,
>>> I’d have to do something like:
>>> stop player myPlayer
>>> put the duration of player myPlayer into endTime
>>> set the startTime of player myPlayer to 1
>>> set the endTime of player myPlayer to endTime
>>> set the playSelection of player 1 to true
>>> start player myPlayer
>> 
>> Just tested with LC 7.04 (never worked with the new AVFoindation player
>> object before)
>> and this single line will it:
>>>> set the currenttime of player "myplayer“ to 0
>> ## Or any other time in the audio/movie
>>>> No need to stop the player or set a selection from STARTTIME to ENDTIME.
>> Playback will continue!
>> 
>>> Do I have to stop, then start the player to get it to jump to a
>>> particular location?
>> 
>> See above.
>> 
>>> And, is there a way to keep the other player going, without being
>>> affected by commands and the stack losing focus?
>> 
>> Sorry, not sure I understand your exact problem?
>> 
>>> Thanks, Klaus, for your input.
>>> Best,
>>> Bill
>> 
>> Best
>> 
>> Klaus
>> 
>> --
>> Klaus Major
>> http://www.major-k.de
>> 

> klaus@

>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> 

> use-livecode at .runrev

>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list

> use-livecode at .runrev

> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





-----
"The difference between genius and stupidity is; genius has its limits." - Albert Einstein
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/struggling-with-player-tp4691531p4691540.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list