avplayer

AVPlayer not playing m3u8 from local file

筅森魡賤 提交于 2019-12-19 10:34:23
问题 I am trying to get AVPlayer to play a m3u8 playlist that is a local file. I have narrowed this down to a simple test case using one of Apple's sample playlists: https://tungsten.aaplimg.com/VOD/bipbop_adv_fmp4_example/master.m3u8 If i play this playlist from the remote url, AVPlayer plays this fine. However, if i download this playlist to a local file, and then hand AVPlayer the local file URL, AVPlayer will not play it. It just shows the crossed out play symbol. Interestingly enough, this

Stitching two videos

纵饮孤独 提交于 2019-12-19 10:26:41
问题 I need to create one video composed by two stitched videos like the following image: Actually I'm playing the two videos simultaneously with two instances of AVPlayer, but I need to create the final video with those two videos: Final video = [1 | 2] Do you have any ideas of how to do this? This is the code I use to play the two videos: - (void)viewDidLoad { [super viewDidLoad]; NSURL *url = [[NSBundle mainBundle] URLForResource:@"video_1" withExtension:@"mp4"]; self.mPlayer = [AVPlayer

swift: How to take screenshot of AVPlayerLayer()

淺唱寂寞╮ 提交于 2019-12-19 09:51:50
问题 How to take screenshot of AVplayerLayer. I tried with the following code it works well, it captures the entire view as it was func screenShotMethod() { let window = UIApplication.shared.delegate!.window!! //capture the entire window into an image UIGraphicsBeginImageContextWithOptions(window.bounds.size, false, UIScreen.main.scale) window.drawHierarchy(in: window.bounds, afterScreenUpdates: false) let windowImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() //now

How to detect when an AVPlayerItem is finished playing? [duplicate]

。_饼干妹妹 提交于 2019-12-19 05:08:26
问题 This question already has answers here : How to detect when AVPlayer video ends playing? (10 answers) Closed 3 months ago . I've been looking through the AVPlayerItem and AVPlayer docs and there doesn't seem to be any callbacks for when the item is finished playing. I was hoping that there would be some sort of delegate callback that we can utilize or that AVPlayerActionAtItemEnd would provide a custom action for us to write. How can i figure out a way to detect when AVPlayer has finished

iOS: Updating Media Information in the Background

有些话、适合烂在心里 提交于 2019-12-19 04:56:27
问题 I'm currently using MPNowPlayingInfoCenter for my app to show which song is playing, but I am looking to incorporate HTTP Live Streaming into my application, which will have any number of different tracks occurring in the background. Is there a way to set the nowPlayingInfo while the application is in the background (Call a function after a certain amount of time?), even though applications technically don't actually run in the background? Or is there a way to set the now playing information

iOS: Updating Media Information in the Background

余生颓废 提交于 2019-12-19 04:56:07
问题 I'm currently using MPNowPlayingInfoCenter for my app to show which song is playing, but I am looking to incorporate HTTP Live Streaming into my application, which will have any number of different tracks occurring in the background. Is there a way to set the nowPlayingInfo while the application is in the background (Call a function after a certain amount of time?), even though applications technically don't actually run in the background? Or is there a way to set the now playing information

AVPlayer not playing MP3 audio file in documents directory iOS

和自甴很熟 提交于 2019-12-19 04:07:18
问题 I'm using AVPlayer to play a MP3 located in the documents directory (file is confirmed to be in there) - I load the AVPlayerItem wait for the AVPlayerItemStatusReadyToPlay then instantiate the AVPlayer with the item and play. The AVPlayerItemStatusReadyToPlay does get called, but no audio actually plays, anyone have an idea why? - (void)checkFileExists { if (![[NSFileManager defaultManager] fileExistsAtPath:[self.urlForEightBarAudioFile path]]) { [self beginEightBarDownload]; } else { // set

AVPlayer doesn't resume playback on endinterruption on iPhone but does so on iPad

社会主义新天地 提交于 2019-12-19 04:06:14
问题 I'm writing a radio app for both iPhone and iPad and am running into some weird behaviour when handling pausing and playing the audio with interruptions. I'm using the AVAudioSessionDelegate methods beginInterruption and endInterruption to respectively pause and play the AVPlayer. Below is the relevant play code. Now, the following situations seem to happen consistently: On iPad: If I force an interruption (Facetime call), beginInterruption is called as expected and playback stops. If the

Multiple AVPlayers in a UIScrollView - only 16 of them are shown

让人想犯罪 __ 提交于 2019-12-19 03:58:49
问题 I'm developing a video gallery, I have a ScrollView with multiple views inside of it, each view has a single AVPlayer - so far it's pretty standard I guess. Note that all of the AVPlayers are pre-loaded with their video, waiting to be played. The problem occurs when I have many items (videos) in the gallery. At any given time - only 16 of them are shown, from start to end, the rest shows a black screen. If I'm reversing the order of the items - the other 16 from the new side are shown, and

Mute audio tracks of live streams using AVPlayer

拟墨画扇 提交于 2019-12-19 03:44:05
问题 I am using AVPlayer to play live stream (m3U8 file). It plays perfectly using AVPlayer but I am not able to mute it. I am using following code to mute the audio. NSMutableArray *allAudioParams = [NSMutableArray array]; for (AVPlayerItemTrack *track in _player.currentItem.tracks) { if ([track.assetTrack.mediaType isEqual:AVMediaTypeAudio]) { AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters]; [audioInputParams setVolume:0.0 atTime