If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

Player duration

have a player, playing 3 songs back to back.

I play first music, during it i get duration correct

when second music comes, it brings to me the old duration back? it doesnt update it back. why so? whats wrong?

 

public int Duration(){
        int i=0;
        if(GlobalValue.playStream!=null){
         i=(int) GlobalValue.playStream.getDuration()/1000 ;
         System.out.println("iiii "+i);
        return i;}
        return i;
        }

 

GlobalValue.playStream is the PLAYER
   

Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

simulator used 7.0 blackberry sdk 9930

i also use 7.0 9810

also same error on my blackberry bold
Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

Basically I have developed a cutom media player. one song after other is played. i bring using getduration the time to diplay it, first song played it shows right..second song comes i debug it..player.duration() still brings me old time
Please use plain text.
Developer
simon_hain
Posts: 15,900
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Player duration

maybe the player object is changed and your global reference points to the old one? i don't know how it works behind the curtains, but you should check the object IDs in the debugger.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

thats a posibiltiy, i will try to go by the code and follow it.. i cant post here it because its too long.

its a mess now
Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

did another testing here is what i get

song 1 1 minute
song 2 2 minute
song 3 3 minute

if i open in that order i get them right

but if i open in this order

song 3 3 minute
song 1 1 minute
song 2 2 minute

i get 3 minute for both songs 1 and 2.
Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

I was able to 100% identify problem
if u solve this to me, i be fine

i am playing the song..how can i stop it and delete it?
because when am deleting it says file is in use..

if i solve this everything done. cause i keep decrypting, encrypting..and since i cant delete..i have the case above i talk bout
Please use plain text.
Developer
babakar
Posts: 697
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Player duration

Done

GlobalValue.playStream.stop();
GlobalValue.playStream.close();

I do this, the close thing i need.
SO I play song 1, when to go to song 2..i do that before to the plaer..then delete file..decrypt song2 to same place and play it.


what was happening, since i was failing in delete.it was copying song over song..
Please use plain text.