public function getOfflineUrl($quality = null)
    {
        $deferred = new Deferred();

        $valid = [self::QUALITY_LOSSLESS, self::QUALITY_HIGH, self::QUALITY_LOW];

        if (array_search($quality, $valid) === false) {
            $quality = self::QUALITY_HIGH;
        }

        $options = Options::buildOptions([
            'soundQuality' => $quality,
        ], [], $this->tidal);

        $this->http->get(
            Options::replace(Endpoints::TRACK_OFFLINE_URL, ['id' => $this->id]).$options
        )->then(function ($response) use ($deferred) {
            $deferred->resolve(new StreamUrl($this->http, $this->tidal, $response));
        }, function ($e) use ($deferred) {
            $deferred->reject($e);
        });

        return $deferred->promise();
    }