[Interest] Playing RTSP video on android

Israel Brewster ijbrewster at alaska.edu
Fri Jul 12 19:23:09 CEST 2024


> On Jul 12, 2024, at 9:18 AM, ekke <ekke at ekkes-corner.org> wrote:
> 
> 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

Good point. Even just using QMultiMedia to play a simple mp3 file included in the resources of the project doesn’t seem to be working, so it well could be an emulator issue. In addition to your suggestion, I’ll have to get my hands on a physical device I can test with. 

Though the VLC app was able to play the video, so I know at least that much works, but that’s not Qt, so dunno.

Hopefully it’s that simple!

---
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

> 
> 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" <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 at qt-project.org <mailto:Interest at qt-project.org>
>> https://lists.qt-project.org/listinfo/interest
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240712/7c17799e/attachment.htm>


More information about the Interest mailing list