我有一个带有媒体视频的iOS项目,但是当我运行此应用时视频是静音的,请帮助我,这是代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MediaCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
NSUInteger row = [indexPath row];
MPMediaItem *item = [self.mediaItems objectAtIndex:row];
cell.textLabel.text = [item valueForProperty:MPMediaItemPropertyTitle];
cell.detailTextLabel.text = [item valueForProperty:MPMediaItemPropertyArtist];
cell.tag = row;
return cell;
}
- (void)loadMediaItemsForMediaType:(MPMediaType)mediaType
{
MPMediaQuery *query = [[MPMediaQuery alloc] init];
NSNumber *mediaTypeNumber= [NSNumber numberWithInt:mediaType];
MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate
predicateWithValue:mediaTypeNumber forProperty:MPMediaItemPropertyMediaType];
[query addFilterPredicate:predicate];
self.mediaItems = [query items];
}
答案 0 :(得分:1)
你在iPad上测试吗?如果是,我已经看到如果侧面开关按钮设置为静音而不是“锁定旋转”并且您碰巧点击它时应用程序音频被静音的问题。检查此wikihow以更改它 - http://www.wikihow.com/Set-Side-Switch-Function-On-an-iPad