Page 1 of 2
libVlc in qml with QtQuick2.0
Posted: 06 Feb 2014 14:33
by topix93
hi, i'm using qt5.2 and vlc 2.1.3 and i need to show a stream rtsp in a qml scene using libvlc. but i don't know how to do that, can anyone help me?
i already made a QWidget that shows me the stream, but now i need to make the same thing in qtquick. it is possible?
Re: libVlc in qml with QtQuick2.0
Posted: 07 Feb 2014 04:49
by RSATom
I started new library for it some time ago, but it's still unfinished:
https://github.com/RSATom/QmlVlc
This library used in WebChimera:
http://rsatom.github.io/WebChimera/
Re: libVlc in qml with QtQuick2.0
Posted: 24 Feb 2014 16:17
by jech
I would be interested in this too. It seems that embedding classic widget to QML is not possible anymore:
http://stackoverflow.com/questions/1301 ... ect-in-qml
If you find a way how to do play a video in QML using libVLC, please let me know. Thanks a lot in advance.
Re: libVlc in qml with QtQuick2.0
Posted: 24 Feb 2014 17:18
by RSATom
If you couldn't use QmlVlc by some reason, you could try
vlc-qt, which has experimental support of qml.
Re: libVlc in qml with QtQuick2.0
Posted: 24 Feb 2014 19:33
by jech
Great. In your pfirst post you've written that it is not finished yet. So I thought that QmlVlc is not ready to use.
Is there an example on how it can be used? Unfortunately I'm really a beginner in C/C++ and I need good documentation and examples to be able to create something that works.
Re: libVlc in qml with QtQuick2.0
Posted: 25 Feb 2014 04:20
by RSATom
It's unfinished, but it's working (you can look WebChimera plugin, it has simple demo)
but for beginner it could be hard, yes. And there are no documentation yet...
Re: libVlc in qml with QtQuick2.0
Posted: 25 Feb 2014 04:36
by RSATom
I'll try to do standalone demo with QmlVlc - it will be useful to me too.
Re: libVlc in qml with QtQuick2.0
Posted: 25 Feb 2014 08:54
by jech
RSATom> Great I'm looking forward to it. Thanks a lot for your work.
Re: libVlc in qml with QtQuick2.0
Posted: 27 Feb 2014 11:00
by topix93
i have tried to use vlc-qt and it's working, but unfortunately there is a memory leak on stop and play.. i tried to find where was the leak, but i was not able to find it... i've already reported the bug but with no solution..
i would like to try the wechimera plugin, maybe it's better
Re: libVlc in qml with QtQuick2.0
Posted: 27 Feb 2014 12:32
by RSATom
I hope to finish QmlVlc's sample on this weekend. Maybe earlier, I almost finished it. But I'm afraid it will be compatible only with Visual Studio 2012 or newer, since I have to use std::thread to avoid dependency from boost. But it will be easy to make some sort of config file, to switch back to boost if it will be needed.
Re: libVlc in qml with QtQuick2.0
Posted: 28 Feb 2014 18:15
by RSATom
Simple demo is ready:
https://github.com/RSATom/QmlVlcDemo
You will need Qt Creator and QT 5.2 to build this sample
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 09:10
by topix93
it works great.. but it crashes when i call vlcPlayer.stop()... maybe is becouse i'm using ubuntu instead of windows/visual studio.. how can i solve this issue?
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 09:57
by RSATom
hm... I didn't try it with linux
can you give me backtrace/call stack?
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 10:04
by RSATom
Maybe I know the reason.
look
https://github.com/RSATom/ya-libvlc-wra ... r.cpp#L100 and try replace
Code: Select all
std::thread( libvlc_media_player_stop, _mp );
with
Code: Select all
std::thread th( libvlc_media_player_stop, _mp );
th.detach();
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 10:28
by topix93
yeah now it work...
i add this code in basic_2.qml:
Code: Select all
function stopAndStart(){
vlcPlayer.stop()
vlcPlayer.play(vlcPlayer.mrl)
}
Timer {
id: myTimer
interval: 10000 //ms
running: true
repeat: true
onTriggered: stopAndStart()
}
but the videosurface freeze and it does not refresh.. can you help me?
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 10:58
by RSATom
I can try little later (within 3-5 hours)
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 11:01
by RSATom
I have some doubt vlcPlayer.mrl returns correct value. I didn't check it yet.
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 11:03
by RSATom
btw, you could try
Code: Select all
vlcPlayer.stop();
vlcPlayer.play();
it should work same
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 12:03
by topix93
i tried but the problem persists
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 12:15
by RSATom
ok, I'll check today.
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 16:04
by RSATom
It was a bug in QmlVlc. It's fixed. Please update your local repo.
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 16:50
by topix93
thank you very much, now it works really great
Re: libVlc in qml with QtQuick2.0
Posted: 04 Mar 2014 16:58
by RSATom
I sure will be another bugs
If you will find some, please create issue on github, thanks.
Re: libVlc in qml with QtQuick2.0
Posted: 20 Nov 2014 23:56
by kfieldi5
Hello RSATom
First of all, thanks a lot for making a library to use libvlc via QML. I am working on a project in Qt widgets that I have just been told may need to go to mobile so am now porting to QML and this is a life-saver.
I am quite novice when it comes to C++ and am not sure how to get your QmlVlcDemo running. I have both the demo and the actual lib cloned into my working directory but I get a QmlVlc.h not found? I know I need to link the library but I see no makefile in the library (QmlVlc project on your github).
Any help would be much appreciated, I'm still fairly new in the Qt and C++ world.
Thanks,
Kevin
Re: libVlc in qml with QtQuick2.0
Posted: 21 Nov 2014 02:50
by RSATom
You should just add all files from qmlvlc to your project and build it altogether.