have you tried Qt Example Declarative Camera ?
you should be able to record or view videos.
sometimes there are problems running on emulator, so it's a good idea to
verify
Am 10.07.24 um 19:32 schrieb Israel Brewster via Interest:
Environment:
Qt version: 6.6.3
Android version: 14, running via emulator
Android build-tools version: 34.0.0 (also tried 31.0.0)
Android build platform SDK: android-33 (also tried android-34)
JDK version 17 (tried 21 early on, but that one wouldn’t even
build/deploy)
NDK version 25.1.8937393 (26.1.10909125 and 27.0.11902837 don’t create
any kits, so not using them)
Building using Qt Creator version 12.0.2 on MacOS
Question/problem:
So now that I have photos displaying on Android, I wanted to be able
to display a RTSP stream. To that end, I have the following code:
void MainWindow::testMediaPlayer(){
if(videoFrame!=nullptr){
videoFrame->deleteLater();
}
videoFrame=new QVideoWidget;
ui->videoLayout->addWidget(videoFrame);
if(videoPlayer!=nullptr){
videoPlayer->deleteLater();
}
if(audioOutput!=nullptr){
audioOutput->deleteLater();
}
videoPlayer=new QMediaPlayer;
connect(this, &MainWindow::stopRTSP,
videoPlayer,&QMediaPlayer::stop,
Qt::QueuedConnection);
audioOutput=new QAudioOutput;
videoPlayer->setAudioOutput(audioOutput);
videoPlayer->setVideoOutput(videoFrame);
videoPlayer->setSource(QUrl("rtsp://xx.xx.xx.xx:554/11"));
ui->viewStack->setCurrentIndex(1); //using a stacked widget to
display video separately from still images.
videoPlayer->play();
}
This code works fine when compiled/run on my mac, but when run on
Android I just get a black screen. The QMediaPlayer documentation
seems to indicate that FFMPEG is used on both Mac and Android
platforms, so it seems as though if it works on one, it should work on
the other (unless the Android version of FFMPEG is more limited?)
I tried giving my app the android.permission.INTERNET, which returns
that it is granted when I request it, but that doesn’t appear to have
helped.
Also, VLC on the emulator does play the video correctly, so apparently
it’s not an access issue with the tablet not being able to access the
stream.
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory
Geophysical Institute - UAF
2156 Koyukuk Drive
Fairbanks AK 99775-7320
Work: 907-474-5172
cell: 907-328-9145
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest