• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems Hiding/Showing NSMovieView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems Hiding/Showing NSMovieView


  • Subject: Re: Problems Hiding/Showing NSMovieView
  • From: Michael Diehr <email@hidden>
  • Date: Fri, 4 Feb 2005 13:07:57 -0800

After some experimentation, I found that the best way to solve both problems was to be to pause the movie, remove the subview, and then add the subview when I'm done.

So the revised code is something like this:

  // stop the movie
  [movieView stop:self];
  // retain and remove the subview
  [movieView retain];
  [movieView removeFromSuperview];

  // set a flag to remind us to display the warning message in drawRect handler
  showWarningMessage = YES;
  // request a full window update
  [self setNeedsDisplay:YES];

[... wait a while...]

  // add the subview back.
  [self addSubview:movieView];
  // start playing
  [movieView start:self];

So, moral of this story seems to be -- if you want to hide a playing movie, it's better to pause it and remove the subview, than to try to move it offscreen...



At 2:25 PM -0500 2/4/05, Douglas A. Welton wrote:
Michael,

Have you considered using a tabless NSTabView to "multi-task" the space that
you are concerned with?  Alternately, you might want to consider subclassing
NSMovieView and handling the different situations in the -drawRect: method.
I did the following when I wanted to center my movie against a user-selected
color background.

later,

douglas

on 2/4/05 1:53 PM, Michael Diehr at email@hidden wrote:

 I have the need to set up a NSMovieView, start a movie playing, and
 then at a later point, hide the movie and display some text onscreen
 (where the movie player was), then un-hide the movie and resume
 playback.

 My strategy has been to do this:

// stop the movie
[movieView stop:self];
// move the movieplayer way offscreen (-10000,-10000)
[movieView setFrameOrigin:wayOffscreen];
// set a flag to remind us to display the warning message in drawRect handler
showWarningMessage = YES;
// request a full window update
[self setNeedsDisplay:YES];


 [... wait a while...]

  // move the movieplayer back to it's proper location
  [movieView setFrameOrigin:mpOrigin];
  // start playing
  [movieView start:self];


Under 10.3 this works great.

 However, under 10.2, it fails in several different ways.  First, if
 the movie is in fact a Flash track, then when I issue the second
 start command, the movie never resumes playback.   Second, if the
 movie is a regular video track, then although it will resume playback
 fine, it never goes offscreen -- my warning message never gets
 displayed -- the last frame of the movie stays onscreen.

 Is there a better way to do this? I see that under 10.3 you can now
 make a NSView 'hidden' but this is not available in 10.2.

 How do you tell quicktime "Hey, please start playing that movie again!"

 NB:  I think there is a general bug in quicktime with respect to
 resizing or movie windows.  For example, fairly often in QuickTime
 Player, or when viewing files in the Finder's Column view, I can get
 in a state where the movie is playing, but nothing is happening
 onscreen.  Only by adjusting the playback size can I get quicktime to
 "resync" and actually resume displaying data...
 _______________________________________________
 Do not post admin requests to the list. They will be ignored.
 QuickTime-API mailing list      (email@hidden)
 Help/Unsubscribe/Update your Subscription:

k.net
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Problems Hiding/Showing NSMovieView (From: "Douglas A. Welton" <email@hidden>)

  • Prev by Date: NSObjectController and the undo manager
  • Next by Date: Re: NSView and NSMenuItem not updating displays
  • Previous by thread: Re: Problems Hiding/Showing NSMovieView
  • Next by thread: patching images together
  • Index(es):
    • Date
    • Thread