Hello,

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;
    return;
  }

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

    LOG(Media, "MediaPlayerPrivatePhonon::play()");
    m_mediaObject->play();
  }
  else
  {
    LOG(Media, "MediaPlayerPrivatePhonon::pause()");
    m_mediaObject->pause();
  }
}

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

Thank you,
Mihai Adrian

_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to