Skip to main content

Player realization !

3 replies [Last post]
Anonymous

Hello all,
In my application I am trying to play the media file using APIs of the class named Player.
However as all of you know playing of a media acually goes through set of states namely,

UNREALIZED,REALIZED,PREFETCHED and finally STARTED.

Inorder to move to REALIZED state player takes a while for it communicates either to server or it may be reading the file.
During this period what I want to do is I want to show a progress indicator (gauge in midp) untill it moves to realized state.
But when I call realize() method it blocks there and I wont be able to set the value to the progress bar.

So how can I achieve this ?

With Best Regards,
Raghavendra. K. Naik
Analyst - ISI Practice
PA Consulting Group
* Nitesh Broadway, M.G.Road, Bangalore
> * +91 25318855 - ext. 28381
> * Raghavendra.Naik@paconsulting.com
> * http://www.paconsulting.com
>
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Raghavendra K. Naik

hi armand,
just have a look at the piece of code.
this code is getting executed within a thread.

public void run()

{

try

{

if(!display.getCurrent().equals(wait))

display.setCurrent(wait);

while((player.getState() == Player.UNREALIZED))

{

int gaugeValue = gauge.getValue();

gaugeValue = gauge.getValue()+1;

if(gaugeValue <= gauge.getMaxValue())

gauge.setValue(gaugeValue);

else

gauge.setValue(1);

Thread.sleep(1000);

Realize();

playMedia();

}

}

catch(Exception e)

{

System.out.println(e.getMessage());

e.printStackTrace();

}

}

and my Realize method is as follows.
============================

public void Realize()

{

new Thread(new Runnable()

{

public void run()

{

try

{

player.realize();

}

catch (MediaException e)

{

e.printStackTrace();

}

}

}).start();

}

where have i gone wrong ? :(

_____

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of armand dos santos
Sent: 12 December 2006 16:42
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Player realization !

Hi Naik,

You can create another thread responsible for the progress
indicator display and update.

Armand

On 12/12/06, Raghavendra K. Naik
wrote:

Hello all,
In my application I am trying to play the media file using APIs
of the class named Player.
However as all of you know playing of a media acually goes
through set of states namely,

UNREALIZED,REALIZED,PREFETCHED and finally STARTED.

Inorder to move to REALIZED state player takes a while for it
communicates either to server or it may be reading the file.

During this period what I want to do is I want to show a
progress indicator (gauge in midp) untill it moves to realized state.

But when I call realize() method it blocks there and I wont be
able to set the value to the progress bar.

So how can I achieve this ?

With Best Regards,
Raghavendra. K. Naik
Analyst - ISI Practice
PA Consulting Group
? Nitesh Broadway, M.G.Road, Bangalore
* +91 253 18855 - ext. 28381
* Raghavendra.Naik@paconsulting.com
* http://www.paconsulting.com

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

armand dos santos

In you current code, the player.realize() might be invoked several times
(until the player state changes to REALIZED or something else). So first,
you need to put the gauge update in a separate thread and not the reverse.
Something like:

(gaugeUpdateThread = new GaugeUpdateThread()).start();
player.realize();
gaugeUpdateThread.stopUpdate();
player.start();
....

Armand

On 12/12/06, Raghavendra K. Naik wrote:
>
> hi armand,
> just have a look at the piece of code.
> this code is getting executed within a thread.
>
> *
>
> public
> * *void* run()
>
> {
>
> *try*
>
> {
>
> *if*(!display.getCurrent().equals(wait))
>
> display.setCurrent(wait);
>
> *while*((player.getState() == Player.*UNREALIZED*))
>
> {
>
> *int* gaugeValue = gauge.getValue();
>
> gaugeValue = gauge.getValue()+1;
>
> *if*(gaugeValue <= gauge.getMaxValue())
>
> gauge.setValue(gaugeValue);
>
> *else*
>
> gauge.setValue(1);
>
> Thread.*sleep*(1000);
>
> Realize();
>
> playMedia();
>
> }
>
> }
>
> *catch*(Exception e)
>
> {
>
> System.*out*.println(e.getMessage());
>
> e.printStackTrace();
>
> }
>
> }
> and my Realize method is as follows.
> ============================
>
> *
>
> public
> * *void* Realize()
>
> {
>
> *new* Thread(*new* Runnable()
>
> {
>
> *public* *void* run()
>
> {
>
> *try*
>
> {
>
> player.realize();
>
> }
>
> *catch* (MediaException e)
>
> {
>
> e.printStackTrace();
>
> }
>
> }
>
> }).start();
>
> }
>
>
>
> where have i gone wrong ? :(
>
> ------------------------------
> *From:* A mailing list for KVM discussion [mailto:
> KVM-INTEREST@JAVA.SUN.COM] *On Behalf Of *armand dos santos
> *Sent:* 12 December 2006 16:42
> *To:* KVM-INTEREST@JAVA.SUN.COM
> *Subject:* Re: Player realization !
>
> Hi Naik,
>
> You can create another thread responsible for the progress indicator
> display and update.
>
> Armand
>
> On 12/12/06, Raghavendra K. Naik
> wrote:
> >
> > Hello all,
> > In my application I am trying to play the media file using APIs of the
> > class named Player.
> > However as all of you know playing of a media acually goes through set
> > of states namely,
> >
> > UNREALIZED,REALIZED,PREFETCHED and finally STARTED.
> >
> > Inorder to move to REALIZED state player takes a while for it
> > communicates either to server or it may be reading the file.
> >
> > During this period what I want to do is I want to show a progress
> > indicator (gauge in midp) untill it moves to realized state.
> >
> > But when I call realize() method it blocks there and I wont be able to
> > set the value to the progress bar.
> >
> > So how can I achieve this ?
> >
> > *With Best Regards,*
> > *Raghavendra. K. Naik*
> > *****Analyst - ISI Practice*
> > *PA Consulting Group*
> > ? Nitesh Broadway, M.G.Road, Bangalore
> > ( +91 253 18855 - ext. 28381
> > **** * Raghavendra.Naik@paconsulting.com
> > 8 ***http://www.paconsulting.com*
> > ===========================================================================
> > To unsubscribe, send email to listserv@java.sun.com and include in the
> > body of the message "signoff KVM-INTEREST". For general help, send email to
> > listserv@java.sun.com and include in the body of the message "help".
>
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

armand dos santos

Hi Naik,

You can create another thread responsible for the progress indicator
display and update.

Armand

On 12/12/06, Raghavendra K. Naik wrote:
>
> Hello all,
> In my application I am trying to play the media file using APIs of the
> class named Player.
> However as all of you know playing of a media acually goes through set of
> states namely,
>
> UNREALIZED,REALIZED,PREFETCHED and finally STARTED.
>
> Inorder to move to REALIZED state player takes a while for it communicates
> either to server or it may be reading the file.
>
> During this period what I want to do is I want to show a progress
> indicator (gauge in midp) untill it moves to realized state.
>
> But when I call realize() method it blocks there and I wont be able to set
> the value to the progress bar.
>
> So how can I achieve this ?
>
> *With Best Regards,*
> *Raghavendra. K. Naik*
> *****Analyst - ISI Practice*
> *PA Consulting Group*
> ? Nitesh Broadway, M.G.Road, Bangalore
> ( +91 25318855 - ext. 28381
> **** * Raghavendra.Naik@paconsulting.com
> 8 ***http://www.paconsulting.com*
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]