<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads?]]></title><description><![CDATA[<p dir="auto">how to play/stop audio file(eg. mp3 file) using multi-threads?<br />
is QMediaPlayer thread-safe?<br />
what i want is: open/play a mp3 in one Thread; while pause/stop/close the mp3 file in the other Thread. is there any good way to do this?<br />
thank you!</p>
]]></description><link>https://forum.qt.io/topic/102079/how-to-play-stop-audio-file-eg-mp3-file-using-multi-threads</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 23:01:29 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/102079.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Apr 2019 16:57:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Mon, 10 Jun 2019 19:58:32 GMT]]></title><description><![CDATA[<p dir="auto">Already answered <a href="https://forum.qt.io/topic/103747/">here</a>.</p>
]]></description><link>https://forum.qt.io/post/534176</link><guid isPermaLink="true">https://forum.qt.io/post/534176</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 10 Jun 2019 19:58:32 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Mon, 10 Jun 2019 16:08:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/opengpu">@<bdi>opengpu</bdi></a> said in <a href="/post/524924">how to play/stop audio file(eg. mp3 file) using multi-threads?</a>:</p>
<blockquote>
<p dir="auto">QMediaPlayer</p>
</blockquote>
<p dir="auto">how to play .mp3 file in Windows. the filePath is C:\test\aaa.mp3</p>
]]></description><link>https://forum.qt.io/post/534143</link><guid isPermaLink="true">https://forum.qt.io/post/534143</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Mon, 10 Jun 2019 16:08:37 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 10:39:22 GMT]]></title><description><![CDATA[<p dir="auto">So why don't you simply do what <a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> suggest and use signals/slots?</p>
]]></description><link>https://forum.qt.io/post/525053</link><guid isPermaLink="true">https://forum.qt.io/post/525053</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Thu, 25 Apr 2019 10:39:22 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 10:22:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> i now have 2 threads, one is mainThread, and the other thread belong to some Callback func by some lib.<br />
and play/stop can be both happen on these 2 thread...</p>
]]></description><link>https://forum.qt.io/post/525037</link><guid isPermaLink="true">https://forum.qt.io/post/525037</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Thu, 25 Apr 2019 10:22:00 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 08:51:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/opengpu">@<bdi>opengpu</bdi></a> Why do you have two threads? If you really need two threads then simply send signals for pause/stop from the other thread and pause/stop in the main thread (where your QMediaPlayer is)...</p>
]]></description><link>https://forum.qt.io/post/524979</link><guid isPermaLink="true">https://forum.qt.io/post/524979</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 25 Apr 2019 08:51:16 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 08:51:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/opengpu">@<bdi>opengpu</bdi></a> said in <a href="/post/524831">how to play/stop audio file(eg. mp3 file) using multi-threads?</a>:</p>
<blockquote>
<p dir="auto">is QMediaPlayer thread-safe?</p>
</blockquote>
<p dir="auto">No.</p>
]]></description><link>https://forum.qt.io/post/524978</link><guid isPermaLink="true">https://forum.qt.io/post/524978</guid><dc:creator><![CDATA[kuzulis]]></dc:creator><pubDate>Thu, 25 Apr 2019 08:51:06 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 08:49:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> ok. so you mean i can just play/pause/stop in both mainThread and the other thread?<br />
i am  worried about : sometimes at the same time, stop() is trigered in mainThread &amp; play() is triggered in the other thread...</p>
]]></description><link>https://forum.qt.io/post/524975</link><guid isPermaLink="true">https://forum.qt.io/post/524975</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Thu, 25 Apr 2019 08:49:24 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 04:37:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/opengpu">@<bdi>opengpu</bdi></a> said in <a href="/post/524924">how to play/stop audio file(eg. mp3 file) using multi-threads?</a>:</p>
<blockquote>
<p dir="auto">so should i open a new thread for QMediaPlayer</p>
</blockquote>
<p dir="auto">No. As <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> already said playing media files is ASYNCH already. Playing media files does not block your main thread -&gt; no need for any threads, don't overengeneer the task. To pause/stop simply call pause()/stop()...</p>
]]></description><link>https://forum.qt.io/post/524937</link><guid isPermaLink="true">https://forum.qt.io/post/524937</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 25 Apr 2019 04:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 02:48:03 GMT]]></title><description><![CDATA[<p dir="auto">so should i open a new thread for QMediaPlayer. and callback-thread &amp; mainThread both send msg to the mediaPlayer thread?? and i just use the reference/pointer of the QMediaPlayer(means the QMeidaPlayer is thread-safe &amp; can be used at different threads at the same time)?</p>
]]></description><link>https://forum.qt.io/post/524924</link><guid isPermaLink="true">https://forum.qt.io/post/524924</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Thu, 25 Apr 2019 02:48:03 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Thu, 25 Apr 2019 02:44:29 GMT]]></title><description><![CDATA[<p dir="auto">Play &amp; Stop event may trigger at the same time from different threads.....</p>
]]></description><link>https://forum.qt.io/post/524921</link><guid isPermaLink="true">https://forum.qt.io/post/524921</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Thu, 25 Apr 2019 02:44:29 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Wed, 24 Apr 2019 17:47:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/opengpu">@<bdi>opengpu</bdi></a> said in <a href="/post/524840">how to play/stop audio file(eg. mp3 file) using multi-threads?</a>:</p>
<blockquote>
<p dir="auto">i need to play it in a callback</p>
</blockquote>
<p dir="auto">There is no reason for this to play an audio file in a separate thread since it's async...</p>
]]></description><link>https://forum.qt.io/post/524852</link><guid isPermaLink="true">https://forum.qt.io/post/524852</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 24 Apr 2019 17:47:20 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Wed, 24 Apr 2019 17:15:04 GMT]]></title><description><![CDATA[<p dir="auto">yep. i need to play it in a callback which is not mainThread.<br />
and while playing the mp3, i want to pause/stop the mp3 in  mainThread by press a button.</p>
]]></description><link>https://forum.qt.io/post/524840</link><guid isPermaLink="true">https://forum.qt.io/post/524840</guid><dc:creator><![CDATA[opengpu]]></dc:creator><pubDate>Wed, 24 Apr 2019 17:15:04 GMT</pubDate></item><item><title><![CDATA[Reply to how to play&#x2F;stop audio file(eg. mp3 file) using multi-threads? on Wed, 24 Apr 2019 17:03:07 GMT]]></title><description><![CDATA[<p dir="auto">Why do you want to use it in a thread at all?</p>
]]></description><link>https://forum.qt.io/post/524834</link><guid isPermaLink="true">https://forum.qt.io/post/524834</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 24 Apr 2019 17:03:07 GMT</pubDate></item></channel></rss>