미디어 플레이어 예제
오디오 및 비디오 재생하기.
미디어 플레이어는 다양한 코덱을 사용하여 오디오 및/또는 비디오 파일을 재생할 수 있는 간단한 멀티미디어 플레이어를 보여줍니다.
예제 실행하기
에서 예제를 실행하려면 Qt Creator에서 Welcome 모드를 열고 Examples 에서 예제를 선택합니다. 자세한 내용은 예제 빌드 및 실행하기를 참조하세요.
이 예제에서는 QVideoWidget 에 전달된 QMediaPlayer 객체를 사용하여 비디오 출력을 제어합니다. 애플리케이션에 재생 목록 기능을 제공하기 위해 QPlayList 객체도 사용합니다.
대화 상자에서 재생 및 중지와 같은 다양한 기능을 활성화하기 위해 버튼 클릭 이벤트는 QMediaPlayer 의 재생() 및 중지() 슬롯에 연결된 재생() 및 중지() 신호를 방출합니다.
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());
위젯 '볼륨'을 변경하여 볼륨을 변경할 수 있습니다.
connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
이 예제에서는 QVideoWidget 객체를 통해 비디오 속성을 변경할 수도 있습니다. 버튼 클릭 한 번으로 전체 화면 모드로 전환했다가 다시 돌아올 수 있습니다.
© 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.