Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

JMF video question

Thread view: 
Christian Otteneuer - 25 Apr 2006 15:23 GMT
Hallo ng,

I have a weird problem using the Media Player offered by the JMF.
Please have a look on the following code:

public class MyClass implements ControllerListener{
...
    public void initMediaPlayer() {
        video = new JPanel();
        video.setBackground(null);
        if (player != null)
          player.close ();
          player = new MediaPlayer();
          player.setPlaybackLoop(false);
          player.setPopupActive(false);
          player.addControllerListener (this);
          player.prefetch ();
          video.add(player);
    }

public synchronized void controllerUpdate(ControllerEvent arg0) {
     // set time span (stored in a static variable)
     if (arg0 instanceof RealizeCompleteEvent) {
          player.setMediaTime(new Time(getStartTime()));
          // user may not use the scroller before the stop time have been
reached
          player.setStopTime(new Time(getEndTime()));
          validate();
      return;
     }
    // play the video
     if (arg0 instanceof PrefetchCompleteEvent) {
          player.start ();
          return;
    }
}
}

This will play my video from the positions stored in the static variables
startTime to endTime which is what I wanted. So, it plays a short extract of
my video. The problem is, that the user may not use the "position scroller"
(what's the right name for that?) to get to a position in the video that
lies after endTime. If he does, the program will crash.
When the stop time is reached, it is posible to use the scroller, but only
then.

Does anyone have an idea how I can solve this problem?

Cheers,

Chris
Christian Otteneuer - 25 Apr 2006 17:03 GMT
I think, I found a theoretical solution, But it appears to be not doable in
practise.

 if (arg0 instanceof MediaTimeSetEvent ) {
  player.setStopTime(Clock.RESET);
 }

This code fragment is called, when the user changes the position in the
video. My idea was to change the stopTime. Unfortunately, it throws me an
error:

javax.media.StopTimeSetError: setStopTime() may be set only once on a
Started Clock

Any other ideas anyone?

Cheers in advance,

Chris
andrewthommo@gmail.com - 26 Apr 2006 00:27 GMT
...
> I have a weird problem using the Media Player offered by the JMF.

I don't know the answer to your technical problem, but just
wanted to check you knew of a forum more specific to the JMF.
<http://forum.java.sun.com/forum.jspa?forumID=28>

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.