[webkit-dev] phonon and qtwebkit modifications to make it work

Mihai Adrian mihaiadriangl at yahoo.com
Mon Jul 4 11:04:02 PDT 2011


I use an older version of qtwebkit, but no modification have been done in the phonon backend part ( MediaPlayerPrivatePhonon.h, MediaPlayerPrivatePhonon.cpp) . I made the following modification to allow HTML5 audio/video make it work with phonon:

MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
    : m_player(player)
    , m_networkState(MediaPlayer::Empty)
    , m_readyState(MediaPlayer::HaveNothing)
    , m_mediaObject(new MediaObject())
    , m_videoWidget(new VideoWidget(0))
    , m_audioOutput(new AudioOutput())
    , m_isVisible(false)


    QTimer::singleShot(100, m_videoWidget, SLOT(show()));  //let event loop bread

  // this is needed for m_videoWidget to catch setting attribute 
  // Qt::WA_DontShowOnScreen .  m_videoWidget will not be shown on the screen
  // but will act as a shown widget. This is needed to be rendered in a QPainter.

    m_firstTime = true;

/ /Only this method is called when clicking on the play/pause button, so the 
// logic for play/pause must be implemented here
// webkit calls this function evrey time page loads, so first call is discarded.

void MediaPlayerPrivate::pause()
  if (m_firstTime)
    m_firstTime = false;

  if ( m_mediaObject->state() != Phonon::PlayingState )
    if (m_mediaObject->currentTime() == m_mediaObject->totalTime())
        LOG(Media, "MediaPlayerPrivatePhonon::seek(0)");

    LOG(Media, "MediaPlayerPrivatePhonon::play()");
    LOG(Media, "MediaPlayerPrivatePhonon::pause()");

Without this modifications, HTML5 video doesn't work with phonon. What do you think about ?

Thank you,
Mihai Adrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110704/be2024da/attachment.html>

More information about the webkit-dev mailing list