• R/O
  • SSH
  • HTTPS

xspfqt: Commit


Commit MetaInfo

Révision388 (tree)
l'heure2013-06-27 22:33:02
Auteurmasakih

Message de Log

[Mod] プレイリストの選択状態を再生位置に追随させるようにした

Change Summary

Modification

--- branches/divideMovieViewController/XspfQTPlayerMovieMode.h (revision 387)
+++ branches/divideMovieViewController/XspfQTPlayerMovieMode.h (revision 388)
@@ -22,6 +22,7 @@
2222
2323 XspfQTMovieLoader *_loader;
2424 BOOL _didJoin;
25+ BOOL ignoreChangeTrackEvent;
2526 }
2627
2728 @property (retain) HMXSPFComponent *playlist;
--- branches/divideMovieViewController/XspfQTPlayerMovieMode.m (revision 387)
+++ branches/divideMovieViewController/XspfQTPlayerMovieMode.m (revision 388)
@@ -204,6 +204,7 @@
204204 {
205205 if([keyPath isEqualToString:XspfQTCurrentTrackKey]) {
206206 if(self.didJoin) {
207+ if(ignoreChangeTrackEvent) return;
207208 id number = [change objectForKey:NSKeyValueChangeNewKey];
208209 [self moveToStartPointNuber:number];
209210 [self.playingMovie play];
@@ -234,22 +235,32 @@
234235 // call from XspfQTMovieTimer.
235236 - (void)fire
236237 {
237-
238- // not implementation
239- // TODO: Must implement
240238 // 現在のdurationを取得
239+ QTTime duration = [self.playingMovie currentTime];
241240
242241 // 選択トラックを取得
242+ HMXSPFComponent *currentTrack = self.trackList.currentTrack;
243243
244244 // 選択トラックが再生中か?
245+ // durationに合うトラックを取得
246+ NSUInteger index = [self.trackList indexOfChild:currentTrack];
247+ NSUInteger playingIndex = NSNotFound;
248+
249+ NSUInteger i = 0;
250+ for(id time in durations) {
251+ QTTime qtTime = [time QTTimeValue];
252+ if(QTTimeCompare(qtTime, duration) == NSOrderedDescending) {
253+ playingIndex = i - 1;
254+ break;
255+ }
256+ i++;
257+ }
245258 // 再生中ならreturn
259+ if(index == playingIndex) return;
246260
247- // durationに合うトラックを取得
248- // [[_playlist childAtIndex:0] removeObserver:self forKeyPath:XspfQTCurrentTrackKey];
249- // [track select]
250-// [[_playlist childAtIndex:0] addObserver:self
251-// forKeyPath:XspfQTCurrentTrackKey
252-// options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
253-// context:NULL];
261+ // 再生中トラックを選択
262+ ignoreChangeTrackEvent = YES;
263+ self.trackList.selectionIndex = playingIndex;
264+ ignoreChangeTrackEvent = NO;
254265 }
255266 @end
Afficher sur ancien navigateur de dépôt.