problème with player

28 views
Skip to first unread message

reza azer

unread,
Sep 6, 2015, 4:30:46 PM9/6/15
to AndroidScript
Hi,

I need help

l made an application with 30 images. each image clicked (with event Up Down) must play one short mp3 file (one word only).The problem is when l play more than ~24 mp3 files the player stops to play. l must to restant the application for the rest of mp3 files.
please help.

Regards
azer

reza azer

unread,
Sep 6, 2015, 4:52:26 PM9/6/15
to AndroidScript
Hi,

there is some details
l have done that:

player01=app.CreatePlayer (mp3 file01.....);
player02=app.CreatePlayer (mp3 file02.....);
player03=app.CreatePlayer (mp3 file03.....);
player04=app.CreatePlayer (mp3 file04.....);
...

player30=app.CreatePlayer (mp3 file30.....);

please help

Regards
azer

Steve Garman

unread,
Sep 6, 2015, 5:24:53 PM9/6/15
to AndroidScript
Have you tried doing it all with one player?

Something like this.


//Called when application is started.
function OnStart()
{
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    

    btn1 = app.CreateButton( "One" );
    lay.AddChild( btn1 );
    btn1.SetOnTouch(touch1);

    btn2 = app.CreateButton( "Two" );
    lay.AddChild( btn2 );
    btn2.SetOnTouch(touch2);  
  
    //Add layout to app.    
    app.AddLayout( lay );
    player=app.CreateMediaPlayer();
    player.SetOnReady(onReady);
}

function touch1()
{
    player.SetFile("/sdcard/one.wav");
}

function touch2()
{
    player.SetFile("/sdcard/two.wav");
}

function onReady()
{
    player.Play();
}

reza azer

unread,
Sep 7, 2015, 10:12:35 AM9/7/15
to AndroidScript
Hi Steve,

l thank you for answering me.

I'll try what you told me, with one player and l'll tell you about the result.

thanks a lot.

azer

reza azer

unread,
Sep 7, 2015, 12:40:09 PM9/7/15
to AndroidScript
Hi Chris,

Your idea concerning the use of only one player WORKS.

Good idea.
l thank you very much.

azer

Reply all
Reply to author
Forward
0 new messages