QtWebKit demo browser display web page abnormally when playing flash media on some website



  • Environment: Qt SDK 4.8.1 + 4.7 demo browser + shockwave flash 11.3.300.262 plugin + WIndows XP + MSVC2008

    The browser display abnormally when browsing some web pages that contain flash media, one of
    them is as follows:

    http://news.youku.com/shenzhou2012/index

    Then what may be the problem, a bug or something else? Thanks a lot!



  • Are you using a fancy browser sample application given on the Qt website. If so then you might not be seeing any flash video. In order to watch webpages that have flash videos we have to explicitly enable the flash plugin.

    use the below mention code to enable that.@webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);@

    Note :- Also make sure that you have adobe flash player plugin installed in your PC.



  • Oh, thanks for reply! It is the browser!

    I've just make sure the changes as you point out, but it does not work on some specific site while does well on others.

    An error or warning often occurs when failed that indicate " QFont::setPixelSize: Pixel size <= 0 (0) ".

    Someone has indicated that maybe some font is unavailable on my system:
    http://stackoverflow.com/questions/10530621/solution-for-qtbug-15485qfontsetpixelsize-pixel-size-0-0

    But which one?

    Nevertheless, thanks a lot!

    [quote author="Ashish Mittal" date="1342705133"]Are you using a fancy browser sample application given on the Qt website. If so then you might not be seeing any flash video. In order to watch webpages that have flash videos we have to explicitly enable the flash plugin. use the below mention code to enable that.@webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);@ Note :- Also make sure that you have adobe flash player plugin installed in your PC.[/quote]



  • Oh Cool, actually I am also facing the same problem. Below mention is the link for the site containing one flash video, but I am also getting the same message in the debugger output window as "QFont::setPixelSize: Pixel size <= 0 (0).

    I would wonder if you will provide me the URL for the site where you are getting the same message.

    http://screen.yahoo.com/dark-shadows-featurette-strange-family-29147710.html



  • Hey I just checked with the URL mentioned by you. It is working with me.
    Below mention are the settings for me

    @ webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    webView->settings()->setAttribute(QWebSettings::JavaEnabled, true);
    webView->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled,false);
    webView->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);

    webView->settings()->setDefaultTextEncoding("utf-8");@

    Moreover I am using Qt4.8.1



  • Oh, really? Mine does not work yet!

    Here is another website that failed -
    http://v.ifeng.com/fhlbt/special/i20120720/

    Just scroll the page up and down, you may find that the flash video element on the page looks like dislocationed.

    thx, :)

    [quote author="Ashish Mittal" date="1342762650"]Hey I just checked with the URL mentioned by you. It is working with me. Below mention are the settings for me @ webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true); webView->settings()->setAttribute(QWebSettings::JavaEnabled, true); webView->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled,false); webView->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); webView->settings()->setDefaultTextEncoding("utf-8");@ Moreover I am using Qt4.8.1 [/quote]



  • And with the website http://v.ifeng.com/fhlbt/special/i20120720/, the error mentioned above does not occur, but it exhibates the same problem



  • I just checked the link mentioned by you , it works for me.
    I am using Windows XP machine.



  • oh, my god! I'll change another machine to test it, thx



  • Hi rintec,

    Would you please update me wheather you are able to play the below mention link using qtwebview or not

    http://screen.yahoo.com/dark-shadows-featurette-strange-family-29147710.html

    Regards
    Ashish



  • hi, every link I've mentioned aboved could be played on my system including the one you just mentioned. The only thing strange is that the flash video element on each page looks
    somewhat dislocationed, one of such characteristics is that the actions on the flash video such as full screen cannot be right positioned and thus perform not well.

    [quote author="Ashish Mittal" date="1342791183"]Hi rintec, Would you please update me wheather you are able to play the below mention link using qtwebview or not http://screen.yahoo.com/dark-shadows-featurette-strange-family-29147710.html Regards Ashish [/quote]



  • hi, Ashish, I've tested the program on Windows XP SP3 as well as Windows 7 SP1, the problem exists anywhere.

    Aha, can you or someone else give me some light? thanks!



  • My Error is like this. I had this problem so many days that paused my project. I don't know how to deal with it . Maybe there is some special study point that can explain the reason. Please help!
    thanks all.



  • Hey Rintec, I just got something very interesting that might be helpful for all of us.

    There is a open source QtWebKit based browser available named "Arora",

    I just played my URL there and it was playing perfectly, then I looked in the source code of that browser and got some settings. Try to use same settings in your code and see if the URL mentioned by you works or not.

    For me it is working.

    @ QSettings settings;
    settings.beginGroup(QLatin1String("websettings"));

    QWebSettings *defaultSettings = QWebSettings::globalSettings();
    QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
    int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
    QFont standardFont = QFont(standardFontFamily, standardFontSize);
    standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
    defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());
    int minimumFontSize = settings.value(QLatin1String("minimumFontSize"),
                defaultSettings->fontSize(QWebSettings::MinimumFontSize)).toInt();
    defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize);
    
    QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
    int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
    QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
    fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
    defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());
    
    defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, !(settings.value(QLatin1String("blockPopupWindows"), true).toBool()));
    defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(QLatin1String("enableImages"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, settings.value(QLatin1String("enableLocalStorage"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(QLatin1String("enableInspector"), false).toBool());
    

    #if QT_VERSION >= 0x040600 || defined(WEBKIT_TRUNK)
    defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
    #endif

    QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl();
    defaultSettings->setUserStyleSheetUrl(url);
    
    int maximumPagesInCache = settings.value(QLatin1String("maximumPagesInCache"), 3).toInt();
    QWebSettings::globalSettings()->setMaximumPagesInCache(maximumPagesInCache);
    
    settings.endGroup();@


  • oh, cool!

    I've just checked Arora, it works as an executable. And after I downloaded the source code and compiled it, regretfully I've found that the problem remains on the generated exectuable.

    Anyway, it's a great step since we can find a model. I'll check furthurmore, thanks a lot!

    [quote author="Ashish Mittal" date="1343025665"]Hey Rintec, I just got something very interesting that might be helpful for all of us. There is a open source QtWebKit based browser available named "Arora", I just played my URL there and it was playing perfectly, then I looked in the source code of that browser and got some settings. Try to use same settings in your code and see if the URL mentioned by you works or not. For me it is working. @ QSettings settings; settings.beginGroup(QLatin1String("websettings")); QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); int minimumFontSize = settings.value(QLatin1String("minimumFontSize"), defaultSettings->fontSize(QWebSettings::MinimumFontSize)).toInt(); defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, !(settings.value(QLatin1String("blockPopupWindows"), true).toBool())); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); defaultSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(QLatin1String("enableImages"), true).toBool()); defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, settings.value(QLatin1String("enableLocalStorage"), true).toBool()); defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(QLatin1String("enableInspector"), false).toBool()); #if QT_VERSION >= 0x040600 || defined(WEBKIT_TRUNK) defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); #endif QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); defaultSettings->setUserStyleSheetUrl(url); int maximumPagesInCache = settings.value(QLatin1String("maximumPagesInCache"), 3).toInt(); QWebSettings::globalSettings()->setMaximumPagesInCache(maximumPagesInCache); settings.endGroup();@[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.