メディアプレーヤーの例
オーディオとビデオの再生
メディアプレーヤーは、様々なコーデックを使用してオーディオファイルやビデオファイルを再生できる、シンプルなマルチメディアプレーヤーのデモです。
例の実行
からサンプルを実行するには、 モードを開き、 からサンプルを選択します。 Qt Creatorからサンプルを実行するには、Welcome モードを開き、Examples からサンプルを選択します。詳細については、「例の構築と実行」を参照してください。
この例では、QVideoWidget に渡されたQMediaPlayer オブジェクトを使用して、ビデオ出力を制御します。アプリケーションにプレイリスト機能を持たせるために、QPlayListオブジェクトも使用しています。
ダイアログの再生や停止などの様々な機能を有効にするために、ボタンがクリックされたイベントは、QMediaPlayer の play() と stop() スロットに接続された play() と stop() シグナルを発します。
connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop()));
ボリュームを取得することができます。
controls->setVolume(player->volume());
ウィジェットの'volume'を変更することで、音量を変更することができます。
connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
この例では、QVideoWidget オブジェクトを使って、ビデオ・プロパティを変更することもできます。ボタンを1回クリックするだけで、フルスクリーンモードにすることができます。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.