void MediaPlayerPrivateAVFoundation::setPreload(MediaPlayer::Preload preload) { m_preload = preload; if (!m_assetURL.length()) return; setDelayCallbacks(true); if (m_preload >= MediaPlayer::MetaData && assetStatus() == MediaPlayerAVAssetStatusDoesNotExist) { createAVAssetForURL(m_assetURL); createAVPlayer(); checkPlayability(); } // Don't force creation of the player item unless we already know that the asset is playable. If we aren't // there yet, or if we already know it is not playable, creating it now won't help. if (m_preload == MediaPlayer::Auto && m_assetIsPlayable) createAVPlayerItem(); setDelayCallbacks(false); }
void MediaPlayerPrivateAVFoundation::prepareToPlay() { LOG(Media, "MediaPlayerPrivateAVFoundation::prepareToPlay(%p)", this); m_preload = MediaPlayer::Auto; if (m_havePreparedToPlay) return; m_havePreparedToPlay = true; m_delayingLoad = false; #if ENABLE(OFFLINE_WEB_APPLICATIONS) Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0; ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0; ApplicationCacheResource* resource = 0; if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(m_assetURL), resource) && resource) createAVPlayerForCacheResource(resource); else #endif createAVPlayerForURL(m_assetURL); checkPlayability(); }
void MediaPlayerPrivateAVFoundation::setPreload(MediaPlayer::Preload preload) { m_preload = preload; if (!m_assetURL.length()) return; setDelayCallbacks(true); if (m_preload >= MediaPlayer::MetaData && assetStatus() == MediaPlayerAVAssetStatusDoesNotExist) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0; ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0; ApplicationCacheResource* resource; if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(m_assetURL), resource) && resource) { // AVFoundation can't open arbitrary data pointers, so if this ApplicationCacheResource doesn't // have a valid local path, just open the resource's original URL. if (resource->path().isEmpty()) createAVAssetForURL(resource->url()); else createAVAssetForCacheResource(resource); } else #endif createAVAssetForURL(m_assetURL); createAVPlayer(); checkPlayability(); } // Don't force creation of the player item unless we already know that the asset is playable. If we aren't // there yet, or if we already know it is not playable, creating it now won't help. if (m_preload == MediaPlayer::Auto && m_assetIsPlayable) createAVPlayerItem(); setDelayCallbacks(false); }