timedMetadata' Deprecated. Another method? UPDATED
func metadataOutput(_ output: AVPlayerItemMetadataOutput, didOutputTimedMetadataGroups groups: [AVTimedMetadataGroup], from track: AVPlayerItemTrack?) {
if let item = groups.first?.items.first // make this an AVMetadata item
{
item.value(forKeyPath: "value") // looking for that key bro
let Song = (item.value(forKeyPath: "value")!)
MetaData = "Now Playing: \n \(Song)" // print the results
} else {
MetaData = "MetaData Error" // No Metadata or Could not read
}
What method should I use instead of a deprecated 'resumeAnimation(forKey:)'?
You can retrieve an SCNAnimationPlayer
using animationPlayer(forKey:)
and then set its paused
property to true
.
MPSCNNConvolutionDescriptor neuronFilter deprecated
"You must implement now the convolution family" Anyhow neuronType, neuronParameterA and neuronParameterB...
The process has changed but not that much, I think you would do it without too much trouble.
And yes, neuronFilter is fully deprecated.
This is the new way to go:
Declaration
class MPSCNNConvolutionDescriptor : NSObject
Overview
You use an MPSCNNConvolutionDescriptor object to describe the properties of an MPSCNNConvolution kernel such as its size, pixel format and CPU cache mode.
Don't use a MPSCNNNeuron (neuronFilter) use a MPSCNNKernel instead.
You have a nice day!
Timed Metadata with AVPlayer
Apparently, AVPlayer
automatically requests metadata from Icecast. The code below works perfectly.
class ViewController: UIViewController {
var Player: AVPlayer!
var PlayerItem: AVPlayerItem!
override func viewDidLoad() {
super.viewDidLoad()
PlayerItem = AVPlayerItem(URL: NSURL(string: "http://live.machine.fm/aac"))
PlayerItem.addObserver(self, forKeyPath: "timedMetadata", options: nil, context: nil)
Player = AVPlayer(playerItem: PlayerItem)
Player.play()
}
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) -> Void {
if keyPath != "timedMetadata" { return }
var data: AVPlayerItem = object as AVPlayerItem
for item in data.timedMetadata as [AVMetadataItem] {
println(item.value)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Swift Read in UTF8 String from MPMoviePlayerController metadata
This is a problem in the library, you cannot fix it because the string is already decoded from data.
There is a reason why the whole set of classes was deprecated in iOS 9.
You should use AVPlayerViewController
& AVPlayer
& AVPlayerItem
& AVMetadataItem
.
They are solving this issue. Don't use MPMoviePlayerController
.
Related Topics
How to Hide the Navigationbar When Embedding Swiftui in Uikit
How to Use Objective-C Enum in Swift
Dyld: Library Not Loaded: @Rpath/Libswiftcore.Dylib Problem with New Xcode (10.2)
What Is the "@Exported" Attribute in Swift
How to Setup a Second Component with a Uipickerview
Scenekit Some Textures Have a Red Hue
Swiftui - Foreach Deletion Transition Always Applied to Last Item Only
Why Do I Still Need to Unwrap Swift Dictionary Value
Why No Infinite Loop in Didset
How to Hide the Navigation Back Button in Swiftui
Does Kotlin Has Extension Class to Interface Like Swift
Getting Path for Resource in Command Line Tool
How to Continue Ble Activities Onto Next View Controller
How to Install the Alamofire 4.0 in Xcode 8.0
How to Integrate Latest Sdwebimage API in My Swift Based Project