libVlc in qml with QtQuick2.0

This forum is about all development around libVLC.
topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

libVlc in qml with QtQuick2.0

Postby topix93 » 06 Feb 2014 14:33

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?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 07 Feb 2014 04:49

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/

jech
Blank Cone
Blank Cone
Posts: 41
Joined: 19 Feb 2005 13:46

Re: libVlc in qml with QtQuick2.0

Postby jech » 24 Feb 2014 16:17

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.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 24 Feb 2014 17:18

If you couldn't use QmlVlc by some reason, you could try vlc-qt, which has experimental support of qml.

jech
Blank Cone
Blank Cone
Posts: 41
Joined: 19 Feb 2005 13:46

Re: libVlc in qml with QtQuick2.0

Postby jech » 24 Feb 2014 19:33

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. :oops:

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 25 Feb 2014 04:20

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

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 25 Feb 2014 04:36

I'll try to do standalone demo with QmlVlc - it will be useful to me too.

jech
Blank Cone
Blank Cone
Posts: 41
Joined: 19 Feb 2005 13:46

Re: libVlc in qml with QtQuick2.0

Postby jech » 25 Feb 2014 08:54

RSATom> Great I'm looking forward to it. Thanks a lot for your work.

topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

Re: libVlc in qml with QtQuick2.0

Postby topix93 » 27 Feb 2014 11:00

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

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 27 Feb 2014 12:32

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.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 28 Feb 2014 18:15

Simple demo is ready: https://github.com/RSATom/QmlVlcDemo
You will need Qt Creator and QT 5.2 to build this sample

topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

Re: libVlc in qml with QtQuick2.0

Postby topix93 » 04 Mar 2014 09:10

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?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 09:57

hm... I didn't try it with linux :) can you give me backtrace/call stack?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 10:04

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();

topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

Re: libVlc in qml with QtQuick2.0

Postby topix93 » 04 Mar 2014 10:28

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?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 10:58

I can try little later (within 3-5 hours)

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 11:01

I have some doubt vlcPlayer.mrl returns correct value. I didn't check it yet.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 11:03

btw, you could try

Code: Select all

vlcPlayer.stop(); vlcPlayer.play();
it should work same

topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

Re: libVlc in qml with QtQuick2.0

Postby topix93 » 04 Mar 2014 12:03

i tried but the problem persists

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 12:15

ok, I'll check today.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 16:04

It was a bug in QmlVlc. It's fixed. Please update your local repo.

topix93
Blank Cone
Blank Cone
Posts: 12
Joined: 04 Oct 2013 11:04

Re: libVlc in qml with QtQuick2.0

Postby topix93 » 04 Mar 2014 16:50

thank you very much, now it works really great

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 04 Mar 2014 16:58

I sure will be another bugs :) If you will find some, please create issue on github, thanks.

kfieldi5
New Cone
New Cone
Posts: 2
Joined: 20 Nov 2014 23:52

Re: libVlc in qml with QtQuick2.0

Postby kfieldi5 » 20 Nov 2014 23:56

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

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libVlc in qml with QtQuick2.0

Postby RSATom » 21 Nov 2014 02:50

You should just add all files from qmlvlc to your project and build it altogether.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests