void MediaPlayerPrivateEA::UpdateTimerFired(Timer<MediaPlayerPrivateEA>*) { // We can use this to control the movie playback and make sure the media player is getting all the info it needs. // Currently we just feed it repaint and a pause. This seems to work good enough for basic playback control but // we might have to revise this if further synchronization is needed between a movie player and the internal media player system. ClientUpdateStates(); // Get the natural size here so that we control when it changes (so it does not occur in the paint). ClientUpdate(MediaUpdateInfo::kGetNaturalSize); if (mNaturalSize != GetMediaUpdateInfo().mReturnNaturalSize) { mNaturalSize = GetMediaUpdateInfo().mReturnNaturalSize; mpWebCorePlayer->sizeChanged(); } if (mMediaState == MediaUpdateInfo::kFinished) { mIsFinished = true; if(mIsPlaying) { mIsPlaying = false; // This will trigger a play request when calling the play button. // Pause if done playing so that the play arrow button shows up for possible replay. HTMLMediaElement* element = static_cast<HTMLMediaElement*>(mpWebCorePlayer->mediaPlayerClient()); element->pause(); } } // The movie paint needs to be ticked so that the controls get repainted and the view updated. mpWebCorePlayer->repaint(); }
EncodedJSValue JSC_HOST_CALL jsHTMLMediaElementPrototypeFunctionPause(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLMediaElement::s_info)) return throwVMTypeError(exec); JSHTMLMediaElement* castedThis = static_cast<JSHTMLMediaElement*>(asObject(thisValue)); HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(castedThis->impl()); imp->pause(processingUserGesture()); return JSValue::encode(jsUndefined()); }
JSValue* jsHTMLMediaElementPrototypeFunctionPause(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSHTMLMediaElement::s_info)) return throwError(exec, TypeError); JSHTMLMediaElement* castedThisObj = static_cast<JSHTMLMediaElement*>(thisValue); HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(castedThisObj->impl()); ExceptionCode ec = 0; imp->pause(ec); setDOMException(exec, ec); return jsUndefined(); }
void MediaPlayerPrivate::onPauseStateChanged() { if (!isFullscreen()) return; HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); // Paused state change not due to local controller. if (m_platformPlayer->isPaused()) element->pause(); else { // The HMI fullscreen widget has resumed play. Check if the // pause timeout occurred. m_platformPlayer->processPauseTimeoutIfNecessary(); element->play(); } }