StreetVoice / HysteriaPlayer

Objective-C audio player, sitting on top of AVPlayer
Other
583 stars 99 forks source link

Reordering issue #102

Closed praveenkumar56060 closed 8 years ago

praveenkumar56060 commented 8 years ago

Hello Saiday,

As new version (2.1.5) released with lot of new methods and implementations. I am facing an issue while reordering songs in my Queue.

Like, i've populated all my song data in a TableView. User can pick any song. So, while playing a song, he/she can reorder it. If the user reorder the current playing song, the index of the current items are not changing (I have debugged this) Instead, it works with previous order.

So, how can i manually reset the Index of current song with HysteriaOrder method

@saiday For your reference, please try this SamplePlayer

saiday commented 8 years ago

It's great to see a sample indicating your issue. thanks. But I was not able to build your sample, PlayerCell.h:10:9: 'VYPlayIndicator.h' file not found

It takes me more time to figure it out, if could, could you please upload new sample?

saiday commented 8 years ago

@praveenkumartapmobi it's ok, I fix it by use any dumb view instead. Never mind.

saiday commented 8 years ago

@praveenkumartapmobi Thank you, it's a HysteriaPlayer's bug. Been fixed by https://github.com/StreetVoice/HysteriaPlayer/commit/cca13ae31b3ba01cd946125871faf93804ac1eb1.

Please update to 2.1.6 on CocoaPods.

FYI, I made a few changes in your sample to make it work. In ViewController.m Line 159 ~ 165

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
    id object = [songRecords objectAtIndex:sourceIndexPath.row];
    [songRecords removeObjectAtIndex:sourceIndexPath.row];
    [songRecords insertObject:object atIndex:destinationIndexPath.row];
    [[HysteriaPlayer sharedInstance] moveItemFromIndex:sourceIndexPath.row toIndex:destinationIndexPath.row];
    [tableView reloadData];
}
praveenkumar56060 commented 8 years ago

You can have the "VYPlayIndicator" here

praveenkumar56060 commented 8 years ago

No, the issue still remains there. As i have told you i have disabled the [hysteriaPlayer enableMemoryCached:NO];

So, when we disable the cachememory in HysteiraPlayer. The, self.playerItems will not contains any items. In that case, how could we handle this?

saiday commented 8 years ago

@praveenkumartapmobi Yes, that was a bug. And I just fixed it. Please see: https://github.com/StreetVoice/HysteriaPlayer/blob/cca13ae31b3ba01cd946125871faf93804ac1eb1/HysteriaPlayer/HysteriaPlayer.m#L404-L426

praveenkumar56060 commented 8 years ago

Yes, it got fixed. Thanks :)