Angular HttpClient:如何检查音频流是否在线?

时间:2019-12-22 09:33:23

标签: angular request angular-httpclient

在没有请求获取完整数据流的情况下,检查音频流是否正常运行的正确方法是什么?

我尝试通过创建这样的请求开始:

// Angular HttpClient import
import { HttpClient } from '@angular/common/http';
// http client
  constructor(
    private http: HttpClient,
  )
  // Request
  public getResponse = async(target: string) => {
    let options = {
      method: 'GET',
      headers: {
        // What comes here?
      }
    };
    const result = await new Promise<any>(async (resolve, reject) => {
      await this.http.get(target, options)
      .subscribe(
        data => resolve(data),
        error => reject(error)
      );
    });
    return result;
  }

但是此代码保持运行,因为它获取了完整的音频流。 我该如何修改(标题?)以仅检查响应?

0 个答案:

没有答案