<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tim Dang</title>
    <description>The latest articles on DEV Community by Tim Dang (@projectlac).</description>
    <link>https://dev.to/projectlac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F918419%2Ff823dfd4-b9b2-41d8-a4d1-174f35c5965f.png</url>
      <title>DEV Community: Tim Dang</title>
      <link>https://dev.to/projectlac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/projectlac"/>
    <language>en</language>
    <item>
      <title>I have error when use patchUserMetadata API belong to Auth0-js</title>
      <dc:creator>Tim Dang</dc:creator>
      <pubDate>Tue, 27 Dec 2022 03:54:19 +0000</pubDate>
      <link>https://dev.to/projectlac/i-have-error-when-use-patchusermetadata-api-belong-to-auth0-js-58h8</link>
      <guid>https://dev.to/projectlac/i-have-error-when-use-patchusermetadata-api-belong-to-auth0-js-58h8</guid>
      <description>&lt;p&gt;I’m trying to update metadata for users with pathUserMetadata. Below is my code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; management = new auth0.Management({
    domain: environment.domain,
    token: this.cookieService.get('access_token'),
    clientId: environment.clientId,
    clientSecret: environment.cliendSecret,
    scope: 'create:users read:users update:users openid profile email',
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this.auth0.management.patchUserMetadata(
        'auth0|xxx' , //of xxx
        userMetadata,
        (err, res) =&amp;gt; {
          console.log('err', err);
          console.log('res', res);
        }
);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but it alway return&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Bad HTTP authentication header format",
    "errorCode": "Bearer"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How can I run this API?&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>How to play Streaming Audio?</title>
      <dc:creator>Tim Dang</dc:creator>
      <pubDate>Mon, 24 Oct 2022 06:14:01 +0000</pubDate>
      <link>https://dev.to/projectlac/how-to-play-streaming-audio-1489</link>
      <guid>https://dev.to/projectlac/how-to-play-streaming-audio-1489</guid>
      <description>&lt;p&gt;I have a live call system, and backend receives data from Twilio, with payload is base64 string, sequence of payload and send to me via webSocket. The sound could be played but the quality is not good.&lt;br&gt;
I'm not sure about the reason for it, Internet Connection or my code. I want the quality of sound better. How can i do? Thank!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subject.subscribe(async (msg: any) =&amp;gt; {
      if (msg.event === 'media') {
        if ( !this.audioBuffers[msg.streamSid]) {
            this.audioBuffers[msg.streamSid] = {
            timestamp: '',
            phone: '',
            buffer: [],
          };

          tempAudio[msg.streamSid] = {
            timestamp: [],
            payload: [],
            phone: '',

          };

        }
          tempAudio[msg.streamSid].payload[msg.sequenceNumber] =
            await this.audio_ctx.decodeAudioData(
              this.base64ToBuffer(msg.media)
            );
          var buffer = tempAudio[msg.streamSid].payload.filter(function (el) {
            return el != null;
          });
          this.audioBuffers[msg.streamSid].buffer = buffer;
            }      
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this.audio_ctx.resume()
 const gainNode = this.audio_ctx.createGain();
while (current &amp;lt; this.data.length) {
        const source = this.audio_ctx.createBufferSource();
        source.buffer = this.data[current];
        gainNode.gain.value = this.isMute ? 0 : this.volume;
        gainNode.connect(this.audio_ctx.destination);
        source.connect(gainNode);
        const will_stop = new Promise((res) =&amp;gt; (source.onended = res));

        source.start(0);
        await will_stop;
        current++;

      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>angular</category>
      <category>twilio</category>
    </item>
  </channel>
</rss>
