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. No Mp4 Playback on Release Deployment
Forum Updated to NodeBB v4.3 + New Features

No Mp4 Playback on Release Deployment

Scheduled Pinned Locked Moved Solved General and Desktop
45 Posts 4 Posters 5.5k Views 3 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.
  • mrjjM mrjj

    @celica
    Hi
    Just as a note.
    There is a Qt plugin for Visual Studio that allows the use of UI files
    so nothing needs to be converted.

    C Offline
    C Offline
    celica
    wrote on last edited by
    #34

    @mrjj Yes, I have that but I'm getting lots of errors when for nearly all of the header includes
    visual studio cannot open source QApplication

    mrjjM 1 Reply Last reply
    0
    • C celica

      @mrjj Yes, I have that but I'm getting lots of errors when for nearly all of the header includes
      visual studio cannot open source QApplication

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #35

      @celica
      Ok, it does sound like something in the setup didn't went all well.
      Normally it just works and you can right click an UI files and it opens Designer.
      So while not as good integration as in Creator it should compile fine.

      1 Reply Last reply
      0
      • C celica

        @JKSH Ok thanks
        It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #36

        @celica said in No Mp4 Playback on Release Deployment:

        It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio

        You don't have to build it in Visual Studio.

        1. Build the example in Release mode in Qt Creator.
        2. Check that the example runs correctly in Qt Creator.
        3. Run windeployqt.
        4. Check that the deployed example runs correctly.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        C 2 Replies Last reply
        3
        • JKSHJ JKSH

          @celica said in No Mp4 Playback on Release Deployment:

          It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio

          You don't have to build it in Visual Studio.

          1. Build the example in Release mode in Qt Creator.
          2. Check that the example runs correctly in Qt Creator.
          3. Run windeployqt.
          4. Check that the deployed example runs correctly.
          C Offline
          C Offline
          celica
          wrote on last edited by
          #37

          @JKSH Great, thank you.
          So yes I deployed as a release build then used the command
          windeployqt.exe C:\Qt\Examples\Qt-5.12.2\multimediawidgets\build-player-Desktop_Qt_5_12_2_MSVC2017_32bit-Release\release

          and it works fine.

          https://ibb.co/9rSPFtj
          See screenshot, what does this tell us?

          JKSHJ 1 Reply Last reply
          0
          • JKSHJ JKSH

            @celica said in No Mp4 Playback on Release Deployment:

            It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio

            You don't have to build it in Visual Studio.

            1. Build the example in Release mode in Qt Creator.
            2. Check that the example runs correctly in Qt Creator.
            3. Run windeployqt.
            4. Check that the deployed example runs correctly.
            C Offline
            C Offline
            celica
            wrote on last edited by
            #38

            @JKSH Hi Guys
            Sorry to bother you again but is there anything else I can try here or am I out of luck?

            1 Reply Last reply
            0
            • C celica

              @JKSH Great, thank you.
              So yes I deployed as a release build then used the command
              windeployqt.exe C:\Qt\Examples\Qt-5.12.2\multimediawidgets\build-player-Desktop_Qt_5_12_2_MSVC2017_32bit-Release\release

              and it works fine.

              https://ibb.co/9rSPFtj
              See screenshot, what does this tell us?

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #39

              @celica said in No Mp4 Playback on Release Deployment:

              it works fine.

              Hurray! 🎉🎉🎉

              what does this tell us?

              It tells us that there's nothing wrong with your copy of Qt and nothing wrong with your PC.

              So, there might be something wrong with your app. Post your code from main() (Please post the code in the forum; no need to use a file upload service)

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              C 1 Reply Last reply
              3
              • JKSHJ JKSH

                @celica said in No Mp4 Playback on Release Deployment:

                it works fine.

                Hurray! 🎉🎉🎉

                what does this tell us?

                It tells us that there's nothing wrong with your copy of Qt and nothing wrong with your PC.

                So, there might be something wrong with your app. Post your code from main() (Please post the code in the forum; no need to use a file upload service)

                C Offline
                C Offline
                celica
                wrote on last edited by
                #40

                @JKSH Here is main:
                I have also included the cpp file which does most of the heavy lifting as an uploaded file (this is huge) .
                https://easyupload.io/02m7h9

                #include "incommand.h"
                #include <QtWidgets/QApplication>
                #include "ButtonManager.h"
                #include <QtQuick/QQuickView>
                #include <QObject>
                #include <QtGlobal>
                
                
                
                int main(int argc, char *argv[])
                {
                
                
                	qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
                
                	QCoreApplication::addLibraryPath(".");
                	QApplication application(argc, argv);
                	InCommand mainWindow;
                	
                
                	QObject::connect(&application, SIGNAL(focusChanged(QWidget*, QWidget*)), &mainWindow, SLOT(focusChanged(QWidget*, QWidget*)));
                	mainWindow.setWindowFlags(Qt::FramelessWindowHint | Qt::Window);	//Set borderless window type
                #
                
                
                	QFile styleFile("Resources\\stylesheets\\defaultStyle.css");
                	QFile stylenightFile("Resources\\stylesheets\\NightStyleSheet.css");
                		
                	if (stylenightFile.open(QIODevice::ReadOnly | QIODevice::Text))
                	{
                		application.setStyleSheet(stylenightFile.readAll());
                		stylenightFile.close();
                		qDebug() << " -I: Stylesheet loaded OK";
                	}
                	else
                	{
                		qDebug() << " -E: Can't access default stylesheet!";
                	}
                
                
                #ifndef TESTING_ON_PC
                	application.setOverrideCursor(QCursor(Qt::BlankCursor));
                #endif	
                	QObject::connect(&application, SIGNAL(aboutToQuit()), &mainWindow, SLOT(appClosing()));
                
                	return application.exec();
                }
                
                
                class MyApi : public QObject
                {
                	Q_OBJECT
                public:
                	
                		Q_INVOKABLE virtual void setValue(int i);
                	
                };
                
                JKSHJ 1 Reply Last reply
                0
                • C celica

                  @JKSH Here is main:
                  I have also included the cpp file which does most of the heavy lifting as an uploaded file (this is huge) .
                  https://easyupload.io/02m7h9

                  #include "incommand.h"
                  #include <QtWidgets/QApplication>
                  #include "ButtonManager.h"
                  #include <QtQuick/QQuickView>
                  #include <QObject>
                  #include <QtGlobal>
                  
                  
                  
                  int main(int argc, char *argv[])
                  {
                  
                  
                  	qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
                  
                  	QCoreApplication::addLibraryPath(".");
                  	QApplication application(argc, argv);
                  	InCommand mainWindow;
                  	
                  
                  	QObject::connect(&application, SIGNAL(focusChanged(QWidget*, QWidget*)), &mainWindow, SLOT(focusChanged(QWidget*, QWidget*)));
                  	mainWindow.setWindowFlags(Qt::FramelessWindowHint | Qt::Window);	//Set borderless window type
                  #
                  
                  
                  	QFile styleFile("Resources\\stylesheets\\defaultStyle.css");
                  	QFile stylenightFile("Resources\\stylesheets\\NightStyleSheet.css");
                  		
                  	if (stylenightFile.open(QIODevice::ReadOnly | QIODevice::Text))
                  	{
                  		application.setStyleSheet(stylenightFile.readAll());
                  		stylenightFile.close();
                  		qDebug() << " -I: Stylesheet loaded OK";
                  	}
                  	else
                  	{
                  		qDebug() << " -E: Can't access default stylesheet!";
                  	}
                  
                  
                  #ifndef TESTING_ON_PC
                  	application.setOverrideCursor(QCursor(Qt::BlankCursor));
                  #endif	
                  	QObject::connect(&application, SIGNAL(aboutToQuit()), &mainWindow, SLOT(appClosing()));
                  
                  	return application.exec();
                  }
                  
                  
                  class MyApi : public QObject
                  {
                  	Q_OBJECT
                  public:
                  	
                  		Q_INVOKABLE virtual void setValue(int i);
                  	
                  };
                  
                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by JKSH
                  #41

                  @celica said in No Mp4 Playback on Release Deployment:

                  QMediaPlayer *player = new QMediaPlayer;
                  QMediaPlayer *playernew = new QMediaPlayer;
                  

                  Here is your problem.

                  You must ensure that QApplication is the very first QObject that is constructed in your app.

                  However, your QMediaPlayers are initialized statically (in other words, they are initialized outside of a function), which means they can be created before QApplication. When this happens, they look for the mediaservice plugin but they can't find it (because QApplication hasn't loaded it yet), so they give up and they can't play your video.

                  Go through you entire code base and make sure that you don't have any QObjects that are initialized statically.

                  QCoreApplication::addLibraryPath(".");
                  

                  This line is not necessary. Remove it.

                  (To understand why, read https://doc.qt.io/qt-5/qcoreapplication.html#libraryPaths )

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  C 1 Reply Last reply
                  3
                  • JKSHJ JKSH

                    @celica said in No Mp4 Playback on Release Deployment:

                    QMediaPlayer *player = new QMediaPlayer;
                    QMediaPlayer *playernew = new QMediaPlayer;
                    

                    Here is your problem.

                    You must ensure that QApplication is the very first QObject that is constructed in your app.

                    However, your QMediaPlayers are initialized statically (in other words, they are initialized outside of a function), which means they can be created before QApplication. When this happens, they look for the mediaservice plugin but they can't find it (because QApplication hasn't loaded it yet), so they give up and they can't play your video.

                    Go through you entire code base and make sure that you don't have any QObjects that are initialized statically.

                    QCoreApplication::addLibraryPath(".");
                    

                    This line is not necessary. Remove it.

                    (To understand why, read https://doc.qt.io/qt-5/qcoreapplication.html#libraryPaths )

                    C Offline
                    C Offline
                    celica
                    wrote on last edited by
                    #42

                    @JKSH Thanks so much. This is great.
                    It is now loading the files previously it was not loading i.e.

                    incommandnew\Win32\Release\mediaservice\dsengine.dll
                    

                    Plus the codecs it is now loading.

                    0x000000005d520000  0x8a000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\LAVSplitter.ax
                    
                    0x000000005bc00000  0x23c000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avutil-lav-56.dll
                    0x000000005bbb0000  0x49000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\libbluray.dll
                    0x000000005be40000  0x389000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avformat-lav-58.dll
                    0x000000005c1d0000  0x1350000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avcodec-lav-58.dll
                    0x000000005bb80000  0x2d000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avresample-lav-4.dll
                    

                    The video is still not playing however when it is deployed.

                    JKSHJ 1 Reply Last reply
                    0
                    • C celica

                      @JKSH Thanks so much. This is great.
                      It is now loading the files previously it was not loading i.e.

                      incommandnew\Win32\Release\mediaservice\dsengine.dll
                      

                      Plus the codecs it is now loading.

                      0x000000005d520000  0x8a000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\LAVSplitter.ax
                      
                      0x000000005bc00000  0x23c000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avutil-lav-56.dll
                      0x000000005bbb0000  0x49000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\libbluray.dll
                      0x000000005be40000  0x389000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avformat-lav-58.dll
                      0x000000005c1d0000  0x1350000  C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avcodec-lav-58.dll
                      0x000000005bb80000  0x2d000   C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avresample-lav-4.dll
                      

                      The video is still not playing however when it is deployed.

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #43

                      Great progress!

                      @celica said in No Mp4 Playback on Release Deployment:

                      The video is still not playing however when it is deployed.

                      Then it's time to start debugging your app.

                      Back up your code (using source control, like Git, is best). After that, keep removing large blocks of code from your app and keep retrying the deployment until your problem disappears.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      C 1 Reply Last reply
                      2
                      • JKSHJ JKSH

                        Great progress!

                        @celica said in No Mp4 Playback on Release Deployment:

                        The video is still not playing however when it is deployed.

                        Then it's time to start debugging your app.

                        Back up your code (using source control, like Git, is best). After that, keep removing large blocks of code from your app and keep retrying the deployment until your problem disappears.

                        C Offline
                        C Offline
                        celica
                        wrote on last edited by
                        #44

                        @JKSH Just to close this thread
                        The issue was the videos were not getting deployed.
                        I need to add these as "Additional Files to Deploy" within the Debugging configuration page of VS
                        Once these mp4 files were deployed everything worked.
                        Thanks for all your help

                        JKSHJ 1 Reply Last reply
                        3
                        • C celica

                          @JKSH Just to close this thread
                          The issue was the videos were not getting deployed.
                          I need to add these as "Additional Files to Deploy" within the Debugging configuration page of VS
                          Once these mp4 files were deployed everything worked.
                          Thanks for all your help

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #45

                          @celica Awesome. Happy coding!

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          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