WebView.qml 541 Bytes
Newer Older
Camilo Higuita's avatar
Camilo Higuita committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import QtQuick 2.0
import QtWebEngine 1.5
import "../../utils/Player.js" as Player

WebEngineView
{
    id: webView

    onLoadingChanged:
    {
        if (loadRequest.errorString)
            console.error(loadRequest.errorString);
    }

    onRecentlyAudibleChanged:
    {
        console.log("is playing", recentlyAudible)
        if(recentlyAudible && isPlaying)
        {
            wasPlaying = isPlaying
            Player.pauseTrack()
        }

        if(!recentlyAudible && wasPlaying)
            Player.resumeTrack()
    }
}