Closed kingctan closed 10 years ago
are you sure QmlVlcPlaylist instance is already correctly created when you call get_itemCount in SongsQueue::play2play ?
if I need create QmlVlcPlaylist instance? I create player definded in QML and use
viewer.rootObject()->findChild<QObject*>("player");
to reference the player object,and then use the player's playlist object in c++. any problem if use like this.
do you have public repo with your code?
Sorry,no public repo.
I think something wrong with your code, but can't tell what exactly without debugging.
how do you call SongsQueue::play2play in qml? on which event?
event: Component.onCompleted in the root Rectangle.
I can't add mrl to the player's playerlist using javascript or in the c++ code. it will be crash when I add mrl.
even without SongsQueue ?
I think problem is SongsQueue tries to access to wrong, or not yet created object...
Why not to try create property in SongsQueue of type VlcPlayer and assign it via QML? Then you will not need
viewer.rootObject()->findChild<QObject*>("player");
and it will be more safe
you mean control the player just in QML? I use two player in one UI page. and want add a playlist(added by admin) to player1 when app start. then if anynone add the owner songs, my app should switch to another player2 to load the user's playlist and pause the player1.
I mean something like
VlcPlayer {
id: player;
}
SongsQueue {
id: queue;
linkedPlayer: player;
}
and then you will have no need to use
viewer.rootObject()->findChild<QObject*>("player");
sorry, can't reproduce...