如你所见,我正在播放音频广播.但是,当我按下主页按钮退出应用程序流停止或我听不到.如何在后台继续流式传输并从锁定屏幕中进行监听?
ViewController.Swift
import UIKit
import AVFoundation
import MediaPlayer
import GoogleMobileAds
class ViewController: UIViewController, GADInterstitialDelegate {
@IBOutlet weak var exitMapButton: UIButton!
@IBOutlet weak var radarMap: UIWebView!
var interstitial: GADInterstitial!
func createAndLoadInterstitial() -> GADInterstitial {
var interstitial = GADInterstitial(adUnitID: "ca-app-pub-5378899862041789/2782958552")
interstitial.delegate = self
interstitial.loadRequest(GADRequest())
return interstitial
}
func getAd(){
if (self.interstitial.isReady)
{
self.interstitial.presentFromRootViewController(self)
self.interstitial = self.createAndLoadInterstitial()
}
}
@IBOutlet weak var ataturkButton: UIButton!
@IBOutlet weak var sabihaButton: UIButton!
@IBOutlet weak var esenbogaButton: UIButton!
@IBOutlet weak var weatherButton: UIButton!
@IBOutlet weak var statusLabel: …Run Code Online (Sandbox Code Playgroud) 我正在使用Avplayer来显示视频片段,当我回去(应用程序在后台)视频停止时.我怎么能继续播放视频?
我搜索了后台任务和后台线程,IOS只支持后台音乐(不是视频) http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
这里是关于在后台播放视频的一些讨论
1)https://discussions.apple.com/thread/2799090?start=0&tstart=0
2)http://www.cocoawithlove.com/2011/04/background-audio-through-ios-movie.html
但AppStore中有很多应用程序,可以在背景中播放视频
Swift播放器:https://itunes.apple.com/us/app/swift-player-speed-up-video/id545216639?mt = 8& sign-mpt = int%3D2
SpeedUpTV:https://itunes.apple.com/ua/app/speeduptv/id386986953 ? mt = 8
在我的iPhone应用程序中,我想在应用程序进入后台模式时继续播放视频.
我正在使用AVPlayer而没有找到任何方式在后台播放视频.如果有人能帮助我,我将非常感激.谢谢