avplayer

AVPlayer doesn't play video until a video from UIImagePickerController is played

隐身守侯 提交于 2020-03-25 12:32:09
问题 I'm having a problem which I haven't seen a post like it on here. I have an AVPlayerViewController which plays a video based off the path from my Firebase Database (not Storage). The video plays perfectly as I want it to, but only once I watch a video that is clicked on in the UIImagePickerController elsewhere in the app. So for example, the AVPlayer will show a black background (this occurs with all of the AVPlayer's in the app), except for when I watch a video from the

IOS开发之AVPlayer

∥☆過路亽.° 提交于 2020-03-01 09:36:36
// // ViewController.m // 03-AVPlayer // // Created by 鹿微微鹿 on 16/5/6. // Copyright (c) 2016 年 鹿微微鹿 . All rights reserved. // //AVPlayer #import "ViewController.h" #import <AVFoundation/AVFoundation.h> @interface ViewController (){ // 播放器 AVPlayer *_player; } @property ( weak , nonatomic ) IBOutlet UISlider *sliderProgress; @end @implementation ViewController - ( void )viewDidLoad { [ super viewDidLoad ]; //1. 创建播放源对象 NSString *path = [[ NSBundle mainBundle ] pathForResource : @"MovieTest.mp4" ofType : nil ]; AVPlayerItem *playerItem = [[ AVPlayerItem alloc ] initWithURL :[ NSURL

Swift won't play audio from link - iOS

大憨熊 提交于 2020-02-23 03:40:10
问题 I am using Subsonic so mp3 files are served to me via a webservice. When I test using files that have a .mp3 extension this code works. When I use it with the link I have below it does not. var player: AVPlayer! override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "http://192.168.1.74:4040/rest/download?u=admin&p=admin&v=1.12.0&c=myapp&id=114&format=mp3")! let playerItem = CachingPlayerItem(url: url) playerItem.delegate = self player = AVPlayer(playerItem: playerItem)

iOS media playback controls notification

我与影子孤独终老i 提交于 2020-02-22 07:25:13
问题 I am new to iOS, and developing a cross platform app with Flutter. I am trying to play audio from network URL, which i found it can be done using the AVPlayer . The audio plays when the app is in foreground and in background, but i can display the media playback controls like this: . i used the let mediaController = MPMusicPlayerController.applicationMusicPlayer and then calling self.mediaController.beginGeneratingPlaybackNotifications() , also providing the playing info

Getting error Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when loading AVPlayer

和自甴很熟 提交于 2020-02-04 05:28:27
问题 I am trying to load an AVPlayer when I select a collectionViewCell, Here is my code in didSelectItem : func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if let item = items?[indexPath.item] { showPlayer(item: item) } } func showPlayer(item: Item) { let playerLauncher = PlayerLauncher() playerLauncher.showVideoPlayer() let playerView = PlayerView() playerView.item = item playerView.setupPlayerView() } This is my PlayerLauncher file: class

Why AVPlayer ask several union range in same session?

会有一股神秘感。 提交于 2020-02-02 04:15:40
问题 I'm would to know why AVPlayer ask's union ranges in requests. Example: 1. We have good wi-fi connection. 2. Track with total length = 1000000. AVPlayer in first will ask bytes=0-1 - its ok, it just "ping" the availability of track. But after that it will ask bytes=0-999999 - and get content-len 1000000 ; And after that it will ask bytes=40000-999999 - and get content-len 599999 ; Why it make third request if we must have all data from second request (bytes=0-999999)? 来源: https:/

Why AVPlayer ask several union range in same session?

本小妞迷上赌 提交于 2020-02-02 04:14:33
问题 I'm would to know why AVPlayer ask's union ranges in requests. Example: 1. We have good wi-fi connection. 2. Track with total length = 1000000. AVPlayer in first will ask bytes=0-1 - its ok, it just "ping" the availability of track. But after that it will ask bytes=0-999999 - and get content-len 1000000 ; And after that it will ask bytes=40000-999999 - and get content-len 599999 ; Why it make third request if we must have all data from second request (bytes=0-999999)? 来源: https:/

iOS AVPlayer的一些定制

烂漫一生 提交于 2020-01-28 05:35:01
用户点击了播放视频,但是此时手机是静音状态,产品说静音状态下也需要把声音给播放出来,so~ 原文: https://www.jianshu.com/p/998709165dfd 首先你要确保player的属性muted为NO,即非静音,当然NO是系统默认的。然后设置一下category即可 //静音状态下播放 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; AVAudioSessionCategory是一个字符串枚举,讲一下几个常用的category的含义: // app的声音可与其它app共存,但锁屏和静音模式会被静音,除非当前app是唯一播放的app AVAudioSessionCategoryAmbient // 会停止其他程序的音频播放。当设备被设置为静音模式,音频会随之静音 AVAudioSessionCategorySoloAmbient // 仅用来录音,无法播放音频 AVAudioSessionCategoryRecord // 会停止其它音频播放,并且能在后台播放,锁屏和静音模式都能播放声音 AVAudioSessionCategoryPlayback // 能播也能录,播放默认声音是从听筒出来

AVPlayer SeekToTime not working. Starting from beginning everytime

时光总嘲笑我的痴心妄想 提交于 2020-01-25 17:33:30
问题 I'm having trouble with UISlider and AVPlayer scrubbing method. Every time the method is invoked the player restarts from 0. I tried debugging and seems that the slider value is right but when I Step Over, it's set 0, thus the player restarts. This is what I've tried: var desiredTime = CMTimeMake(Int64(self.progressSlider.value), 1) AudioManager.sharedInstance.audioPlayer.seekToTime(desiredTime) I've also tried looking at similar questions and found that it was the same when I tried their

how can i record a song which is playing with AVPlayer and an wav file at a same time?

梦想的初衷 提交于 2020-01-25 05:01:08
问题 I'm developing an App in which i have to record a song and a wav file at a same time.I'm playing song from iPod Music libraries and on a view controller i have placed a button on click of which an wav file starts but when i start recording using AVAudioRecorder,my wav file stop working. This is my ipod music library's code:- - (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) collection { MPMediaItem *item = [[collection items]