For notifications, I am using a firebase api [cloud messaging ].
I am getting normal notifications in all app states. when I try notifications with the attached image URL, in the foreground the image is displayed and it working properly but when the application is in a background state or terminated the normal text notification is getting without image.
I also tried using the ns-notifications service and contents.
Post
Replies
Boosts
Views
Activity
I am trying to use AVPlayerView Controller But when i try to play the video its crash
This is my Code
`import UIKit
import AVKit
import SwiftyJSON
import Alamofire
import EffyIosFramework
class VideoViewController: UIViewController, AVPlayerViewControllerDelegate {
var player : AVPlayer!
var vc = AVPlayerViewController()
var isVideoPlaying = false
var instance = VideoViewController()
//View Did Load
override func viewDidLoad() {
super.viewDidLoad()
vc.delegate = self
}
//Play Video
func playVideo(url: URL) {
player = AVPlayer(url: url)
vc.player = player
player.automaticallyWaitsToMinimizeStalling = false
vc.delegate = self
vc.showsPlaybackControls = false
vc.videoGravity = AVLayerVideoGravity.resizeAspectFill
let playerLayer = AVPlayerLayer(player: player)
playerLayer.opacity = 0
self.isVideoPlaying = true
self.vc.player?.play()
DispatchQueue.main.asyncAfter(wallDeadline: .now()+0.2) {
self.vc.view.frame = self.view.window!.bounds
self.vc.view.backgroundColor = .clear
DispatchQueue.main.async {
self.vc.view.addSubview(self.view)
}
self.view.window?.addSubview(self.vc.view)
}
}
}