swiftvaporshazam

ShazamKit call from within Swift Vapor Server


When I try to match audio signature with ShazamKit, it works without a problem in my iOS app, because I was able to add ShazamKit to my app identifier on the developer website.

Now, I am trying to do the same thing within my vapor server:

session = SHSession()       
session?.delegate = self        
session?.match(signature!)

but I am getting this error:

[core] Fired XPC service interruption handler <SHShazamKitServiceConnection: 0x600000c157d0>

I believe I should create an id(e.g app id, service identifier, media id) for my server and register it on the developer website. Whatever id I should create, I don know how to add it to my server. In the end I want to be able to make a shazam call from my Swift server app.

For my Swift vapor server, my package file looks like this:

import PackageDescription
import AppleProductTypes

let package = Package(
    name: "SwiftServer",
    platforms: [
        .macOS("12.0")
    ],
    products: [
        .executable(
            name: "SwiftServer",
            targets: ["SwiftServer"]
        )
    ],
    dependencies: [
        .package(url: "https://github.com/vapor/vapor", "4.0.0"..<"5.0.0")
    ],
    targets: [
        .executableTarget(
            name: "SwiftServer",
            dependencies: [
                .product(name: "Vapor", package: "vapor")
            ],
            resources: [
                .process("Resources")
            ]
        ),
        .testTarget(
            name: "SwiftServerTests",
            dependencies: [
                "SwiftServer"
            ]
        )
    ]
)

Appreciate any ideas.


Solution

  • ShazamKit is not available on Linux so you might want to try looking for a different solution