Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. VideoWidget Video With Transparent Background
Forum Updated to NodeBB v4.3 + New Features

VideoWidget Video With Transparent Background

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MrNoway
    wrote on last edited by
    #1

    I am working on a little game,
    and sofar it's going good

    I have some short videos and some parts of them are transparent,
    basically I am talking about effects like blood, dust, fog, sparkle etc. already prekeyed.

    I wanted to use the VideoWidget to show them,
    its working if I set up like this, the problem is that the Widget background is not transparent.

    It's black.

    If I use a label and adding a .gif file, it is transparent,
    this is what I want but I cannot use .gif file because the quality is too poor.

    @ Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
    Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
    videoWidget->move(400,300);
    videoWidget->resize(500,500);
    videoWidget->setWindowOpacity(20);
    Phonon::createPath(mediaObject, videoWidget);

    Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::createPath(mediaObject, audioOutput);

    QString ss2 = "Arrow_01.avi";

    mediaObject->setCurrentSource(ss2);
    mediaObject->play();@

    if I try like this its also not working

    @ videoWidget->setAttribute(Qt::WA_TranslucentBackground);
    videoWidget->setWindowFlags(Qt::FramelessWindowHint);@

    1 Reply Last reply
    1
    • M Offline
      M Offline
      MrNoway
      wrote on last edited by
      #2

      has no one an idea?

      Or can you tell me if there are other options to display videos,
      using maybe external plugins??

      1 Reply Last reply
      1
      • M Offline
        M Offline
        MrNoway
        wrote on last edited by
        #3

        hmm after hours and hours of desperating trying,
        I finally figured something out that seems to be a adequate solution.

        I converted my visual effect video into a .png sequence.
        then I used a normal Widget and set the background image to the first .png file of the sequence.

        then I connected a timer to this function and a counter is moving to the next picture.

        @ movie_name_int++;
        movie_name_string="background-image: url(png_sequence/";
        movie_name_string_temp.setNum(movie_name_int);
        movie_name_string.append(movie_name_string_temp);
        movie_name_string.append(")");
        ui.widget_2->setStyleSheet(movie_name_string );@

        It works pretty good, but I dont know about the performance, if I am gonna use this often.

        anyway
        I am happy I can finally continue
        Merry Christmas

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved