I am streaming a playlist file to AVPlayer. There are many files in the playlist. How can I get the currently played audio file? Getting the URL only returns the playlist url and not the actual song being played from the playlist.
you can get current item by this property.
#interface AVPlayer (AVPlayerItemControl)
/* indicates the current item of the player */
#property (nonatomic, readonly) AVPlayerItem *currentItem;
Related
Using the shortcode audio in Wordrepss [audio src="some-file.mp3"] (this one returns an audio player),
I'm trying to add some params after the file extension: [audio src="some-file.mp3?param1=some-value¶m2=somo-value-two"] etc, but I can see that the shortcode do not retuns the player, this one returns an link to the audio.
Were you able to achieve this somehow?
Thanks.
I'm making a youtube uploader and I wanted to include a feature that would allow you to upload a video and simultaneously add it to a playlist on the uploader's channel, but i hit a roadblock - If i use this code to search for playlists on the channel
SearchResource.ListRequest searchresource = youtubeService.Search.List("id, snippet");
searchresource.Type = "playlist";
searchresource.Q = richTextBox11.Text;
searchresource.MaxResults = 50;
searchresource.ChannelId = channelId;
SearchListResponse searchresponse = searchresource.Execute();
It seems to only search for playlists containing videos with titles containing the text I'm searching for, which in turn causes small playlists with only one or two videos to not come up.
Examples:
Big playlist with 50 videos that comes up
Small playlist with only one video that doesn't come up:
I am implementing a Music related Application. In my application I need to use AVPlayer instead of MPMusicPlayer to play iPod Library songs. I used AVPlayer to support FadeIn and Fadeout effects for the background playback of MPMediaItems. I used MPMediaItemProperyAssetURL to get the url from the MPMediaItem and give it as input to the AVPlayer like follows. My problem is some items are won't play because of null url. I found that songs downloaded from iTunes store (which are DRM protected) were unable to play because they have no MPMediaItemProperyAssetURL. Could you please guys help me, how can I resolve these issues. I need to support these DRM protected songs in AVPlayer. Please take a look at my following code for reference,
MPMediaItem *currentItem = [songs objectAtIndex:songIndex];
NSURL *itemURL = [currentItem valueForProperty:MPMediaItemPropertyAssetURL];
currentlyPlayingItem=[itemURL absoluteString];
avPlayer = [[AVPlayer alloc] initWithURL:itemURL];
[avPlayer play];
Thanks in Advance,
Sekhar.
Regrettably there is no mechanism to load DRM'd files into the AVPlayer or any of the AV Foundation APIs. If you can convince your users to upgrade their entire library at $0.30 per song with iTunes Plus, that is the only way.
Ever since I updated to iOS 5, I can't get MPMoviePlayerViewController to play audio on the iPad. Video is perfect, but no audio is heard. It doesn't matter what format I use. It does not work. It works in the simulator, but not on the iPad.
- (IBAction)playVideo {
NSString *filepath = [[NSBundle mainBundle] pathForResource:#"test" ofType:#"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:#selector(movieFinishedPlaying:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[moviePlayer moviePlayer]];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
}
Anyone else have this problem? Or found a fix?
It sounds silly, but we came across an issue on my team where the volume control for general iPad sounds was muted and this meant that there was no sound for video played in our app, even though music played through the music player or video on websites worked fine.
To check this volume control you can bring up the task manager (double-tap the home button) and then swipe across to the far left and there are some music controls; check that the mute button on this screen is not on.
try this:
...
moviePlayer.useApplicationAudioSession = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
set audio session before allocating MPMoviePlayerController will play sound along with video
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
Ensure the audio format in the video file is something that the iPad can play. I believe the simulator has access to the host machine's codecs, which might explain why the iPad can play the video but not the audio. As noted on this page in the MPMoviePlayerController documentation:
If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.
I just made the slide button on the side into lock screen. Then the sound suddely worked.
I have a video file of in server of size 10MB, I want to play that video in iPad using mpmovieplayercontroller.
NSURL* url = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSLog(#"%#",url);
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
[mp play];
The above is the code i used I am able to play the audio but not able get video in iPad simulator.
Can any one help me
Thanks
You need to add the MoviePlayerController's view as a subview to the currently visible view like this:
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
mp.view.frame = CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f);
[self.view addSubview:mp.view];
[mp play];
most likely the video format is not supported. The supported video formats are: H.264, MPEG-4