More iOS build fixing. MediaPlayerPrivateIOS is defunct and can be removed.
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 02:46:07 +0000 (02:46 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 02:46:07 +0000 (02:46 +0000)
Fix some build errors in other media files.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/MediaPlayer.cpp:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/ios/MediaPlayerPrivateIOS.h: Removed.
* platform/graphics/ios/MediaPlayerPrivateIOS.mm: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168082 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.h [deleted file]
Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm [deleted file]

index 12a7bb6..aaa0482 100644 (file)
@@ -1,5 +1,16 @@
 2014-04-30  Simon Fraser  <simon.fraser@apple.com>
 
+        More iOS build fixing. MediaPlayerPrivateIOS is defunct and can be removed.
+        Fix some build errors in other media files.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/MediaPlayer.cpp:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        * platform/graphics/ios/MediaPlayerPrivateIOS.h: Removed.
+        * platform/graphics/ios/MediaPlayerPrivateIOS.mm: Removed.
+
+2014-04-30  Simon Fraser  <simon.fraser@apple.com>
+
         Fix the iOS build, which no longer needs these calls
         to enter/exitFullscreen.
 
index 0497131..3814e78 100644 (file)
                073BE34E17D180B2002BD431 /* RTCSessionDescriptionDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221BAB17CF0AD400848E51 /* RTCSessionDescriptionDescriptor.cpp */; };
                073BE34F17D18183002BD431 /* RTCIceCandidateDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221BA617CF0AD400848E51 /* RTCIceCandidateDescriptor.cpp */; };
                073BE35017D181A6002BD431 /* RTCPeerConnectionHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221BA817CF0AD400848E51 /* RTCPeerConnectionHandler.cpp */; };
-               074300A50F4B8BCF008076CD /* MediaPlayerPrivateIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 074300A30F4B8BCF008076CD /* MediaPlayerPrivateIOS.mm */; };
-               074300A60F4B8BCF008076CD /* MediaPlayerPrivateIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 074300A40F4B8BCF008076CD /* MediaPlayerPrivateIOS.h */; };
                074E82BA18A69F0E007EF54C /* PlatformTimeRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 074E82B818A69F0E007EF54C /* PlatformTimeRanges.cpp */; };
                074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0753860014489E9800B78452 /* CachedTextTrack.cpp */; };
                073BE34517D17E7A002BD431 /* JSNavigatorUserMediaErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorUserMediaErrorCallback.h; sourceTree = "<group>"; };
                073BE34617D17E7A002BD431 /* JSNavigatorUserMediaSuccessCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorUserMediaSuccessCallback.cpp; sourceTree = "<group>"; };
                073BE34717D17E7A002BD431 /* JSNavigatorUserMediaSuccessCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorUserMediaSuccessCallback.h; sourceTree = "<group>"; };
-               074300A30F4B8BCF008076CD /* MediaPlayerPrivateIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPlayerPrivateIOS.mm; sourceTree = "<group>"; };
-               074300A40F4B8BCF008076CD /* MediaPlayerPrivateIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerPrivateIOS.h; sourceTree = "<group>"; };
                074E82B818A69F0E007EF54C /* PlatformTimeRanges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformTimeRanges.cpp; sourceTree = "<group>"; };
                074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformTimeRanges.h; sourceTree = "<group>"; };
                0753860014489E9800B78452 /* CachedTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedTextTrack.cpp; sourceTree = "<group>"; };
                                FED13D3F0CEA939400D89466 /* IconIOS.mm */,
                                07357C7616D2DF0D00ED99E7 /* InbandTextTrackPrivateAVFIOS.h */,
                                07357C7716D2DF0D00ED99E7 /* InbandTextTrackPrivateAVFIOS.mm */,
-                               074300A40F4B8BCF008076CD /* MediaPlayerPrivateIOS.h */,
-                               074300A30F4B8BCF008076CD /* MediaPlayerPrivateIOS.mm */,
                                37E6594F163B10C200EB4574 /* SimpleFontDataIOS.mm */,
                                CEEC6034187DD962003E43BB /* TextTrackRepresentationIOS.h */,
                                CDCA82941679100F00875714 /* TextTrackRepresentationIOS.mm */,
                                E44613E40CD681A200FADA75 /* MediaPlayer.h in Headers */,
                                076F0D0E12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h in Headers */,
                                DF9AFD7213FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h in Headers */,
-                               074300A60F4B8BCF008076CD /* MediaPlayerPrivateIOS.h in Headers */,
                                CDC8B5A3180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.h in Headers */,
                                E44613E60CD681A900FADA75 /* MediaPlayerPrivateQTKit.h in Headers */,
                                0735EE6A0F40C5E4004A2604 /* MediaPlayerProxy.h in Headers */,
                                E44613E30CD6819F00FADA75 /* MediaPlayer.cpp in Sources */,
                                072C8B11131C518600A4FCE9 /* MediaPlayerPrivateAVFoundation.cpp in Sources */,
                                DF9AFD7313FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm in Sources */,
-                               074300A50F4B8BCF008076CD /* MediaPlayerPrivateIOS.mm in Sources */,
                                CDC8B5A2180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.mm in Sources */,
                                E44613E50CD681A600FADA75 /* MediaPlayerPrivateQTKit.mm in Sources */,
                                4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */,
index ec34fa3..da5065a 100644 (file)
 #endif
 
 #if PLATFORM(COCOA)
-#if PLATFORM(IOS)
-#include "MediaPlayerPrivateIOS.h"
-#else
 #include "MediaPlayerPrivateQTKit.h"
-#endif
 #if USE(AVFOUNDATION)
 #include "MediaPlayerPrivateAVFoundationObjC.h"
 #if ENABLE(MEDIA_SOURCE)
diff --git a/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.h b/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.h
deleted file mode 100644 (file)
index 93f1c77..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef MediaPlayerPrivateIOS_h
-#define MediaPlayerPrivateIOS_h
-
-#if ENABLE(VIDEO) && PLATFORM(IOS)
-
-#include "InbandTextTrackPrivateAVF.h"
-#include "MediaPlayer.h"
-#include "MediaPlayerPrivate.h"
-#include "MediaPlayerProxy.h"
-#include <objc/runtime.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS NSDictionary;
-OBJC_CLASS NSMutableDictionary;
-OBJC_CLASS NSNumber;
-OBJC_CLASS NSObject;
-OBJC_CLASS WebCoreMediaPlayerNotificationHelper;
-
-namespace WebCore {
-
-class InbandTextTrackPrivateAVFIOS;
-
-class MediaPlayerPrivateIOS : public MediaPlayerPrivateInterface, public AVFInbandTrackParent {
-public:
-
-    static void registerMediaEngine(MediaEngineRegistrar);
-    virtual ~MediaPlayerPrivateIOS();
-
-    virtual void deliverNotification(MediaPlayerProxyNotificationType) override;
-    bool callbacksDelayed() { return m_delayCallbacks > 0; }
-    virtual void prepareToPlay() override;
-    void processDeferredRequests();
-
-#if ENABLE(VIDEO_TRACK)
-    void inbandTextTracksChanged(NSArray *);
-    void processInbandTextTrackCue(NSArray *, double);
-    void textTrackWasSelectedByPlugin(NSDictionary *);
-#endif
-
-private:
-    MediaPlayerPrivateIOS(MediaPlayer*);
-
-    // Engine support
-    static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
-    static void getSupportedTypes(HashSet<String>& types);
-    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
-    static bool isAvailable();
-
-    virtual IntSize naturalSize() const override;
-    virtual bool hasVideo() const override;
-    virtual bool hasAudio() const override;
-    virtual bool supportsFullscreen() const override { return true; }
-
-    virtual bool canLoadPoster() const override { return true; }
-    virtual void setPoster(const String& url) override;
-
-    virtual void setControls(bool) override;
-
-    virtual void enterFullscreen() override;
-    virtual void exitFullscreen() override;
-
-    virtual bool hasClosedCaptions() const override;
-    virtual void setClosedCaptionsVisible(bool) override;
-
-    virtual void load(const String& url) override;
-#if ENABLE(MEDIA_SOURCE)
-    virtual void load(const String&, MediaSourcePrivateClient*) override { }
-#endif
-    virtual void cancelLoad() override;
-
-    virtual void play() override;
-    virtual void pause() override;
-
-    virtual bool paused() const override;
-    virtual bool seeking() const override;
-
-    virtual float duration() const override;
-    virtual float currentTime() const override;
-
-    virtual void seek(float time) override;
-    void setEndTime(float);
-
-    float rate() const;
-    virtual void setRate(float inRate) override;
-    virtual float volume() const override;
-    virtual void setVolume(float inVolume) override;
-    virtual void setMuted(bool inMute) override;
-
-    int dataRate() const;
-
-    virtual MediaPlayer::NetworkState networkState() const override;
-    virtual MediaPlayer::ReadyState readyState() const override;
-    
-    float maxTimeBuffered() const;
-    virtual float maxTimeSeekable() const override;
-    virtual std::unique_ptr<PlatformTimeRanges> buffered() const override;
-
-    virtual bool didLoadingProgress() const override;
-    bool totalBytesKnown() const;
-    unsigned totalBytes() const;
-
-    virtual void setVisible(bool) override;
-    virtual void setSize(const IntSize&) override;
-    
-    virtual void paint(GraphicsContext*, const IntRect&) override;
-
-#if ENABLE(IOS_AIRPLAY)
-    virtual bool isCurrentPlaybackTargetWireless() const override;
-    virtual void showPlaybackTargetPicker() override;
-
-    virtual bool hasWirelessPlaybackTargets() const override;
-
-    virtual bool wirelessVideoPlaybackDisabled() const override;
-    virtual void setWirelessVideoPlaybackDisabled(bool) override;
-
-    virtual void setHasPlaybackTargetAvailabilityListeners(bool) override;
-#endif
-
-    virtual bool supportsAcceleratedRendering() const override;
-
-    virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) override;
-    void processPendingRequests();
-
-    void setDelayCallbacks(bool doDelay) { m_delayCallbacks += (doDelay ? 1 : -1); }
-
-    bool usingNetwork() const { return m_usingNetwork; }
-    bool inFullscreen() const { return m_inFullScreen; }
-
-    void addDeferredRequest(NSString *name, id value);
-
-    virtual String engineDescription() const { return String(ASCIILiteral("iOS")); }
-
-    virtual void attributeChanged(const String& name, const String& value) override;
-    virtual bool readyForPlayback() const override;
-
-#if ENABLE(VIDEO_TRACK)
-    virtual bool requiresTextTrackRepresentation() const;
-    virtual void setTextTrackRepresentation(TextTrackRepresentation*);
-
-    void clearTextTracks();
-    void setSelectedTextTrack(NSNumber *);
-    virtual void trackModeChanged() override;
-    void setOutOfBandTextTracks(NSArray *);
-
-    virtual bool implementsTextTrackControls() const { return true; }
-    virtual PassRefPtr<PlatformTextTrackMenuInterface> textTrackMenu();
-
-    void outOfBandTextTracksChanged();
-    void textTrackWasSelectedByMediaElement(PassRefPtr<PlatformTextTrack>);
-#endif
-
-private:
-
-    class PlatformTextTrackMenuInterfaceIOS : public PlatformTextTrackMenuInterface {
-    public:
-        static PassRefPtr<PlatformTextTrackMenuInterfaceIOS> create(MediaPlayerPrivateIOS* owner)
-        {
-            return adoptRef(new PlatformTextTrackMenuInterfaceIOS(owner));
-        }
-
-        virtual ~PlatformTextTrackMenuInterfaceIOS();
-
-        virtual void tracksDidChange() override
-        {
-            if (m_owner)
-                m_owner->outOfBandTextTracksChanged();
-        }
-
-        virtual void trackWasSelected(PassRefPtr<PlatformTextTrack> track) override
-        {
-            if (m_owner)
-                m_owner->textTrackWasSelectedByMediaElement(track);
-        }
-
-        virtual void setClient(PlatformTextTrackMenuClient* client) override { m_client = client; }
-        PlatformTextTrackMenuClient* client() { return m_client; }
-
-    private:
-        PlatformTextTrackMenuInterfaceIOS(MediaPlayerPrivateIOS*);
-
-        PlatformTextTrackMenuClient* m_client;
-        MediaPlayerPrivateIOS* m_owner;
-    };
-
-    MediaPlayer* m_mediaPlayer;
-    RetainPtr<NSObject> m_mediaPlayerHelper; // This is the MediaPlayerProxy.
-    RetainPtr<WebCoreMediaPlayerNotificationHelper> m_objcHelper;
-    RetainPtr<NSMutableDictionary> m_deferredProperties;
-
-    MediaPlayer::NetworkState m_networkState;
-    MediaPlayer::ReadyState m_readyState;
-
-    enum BufferingState { Empty, UnlikeleyToKeepUp, LikeleyToKeepUp, Full };
-
-#if ENABLE(VIDEO_TRACK)
-    InbandTextTrackPrivateAVFIOS* m_currentTrack;
-    Vector<RefPtr<InbandTextTrackPrivateAVFIOS> > m_textTracks;
-    RefPtr<PlatformTextTrackMenuInterfaceIOS> m_menuInterface;
-#endif
-
-    int m_delayCallbacks;
-    int m_changingVolume;
-    mutable unsigned m_bytesLoadedAtLastDidLoadingProgress;
-    float m_requestedRate;
-    BufferingState m_bufferingState;
-    bool m_visible : 1;
-    bool m_usingNetwork : 1;
-    bool m_inFullScreen : 1;
-    bool m_shouldPrepareToPlay : 1;
-    bool m_preparingToPlay : 1;
-    bool m_pauseRequested : 1;
-};
-
-} // namespace WebCore
-
-#endif
-#endif // MediaPlayerPrivateIOS
diff --git a/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm b/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm
deleted file mode 100644 (file)
index 1cd947d..0000000
+++ /dev/null
@@ -1,1261 +0,0 @@
-
-/*
- * Copyright (C) 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import "config.h"
-
-#if ENABLE(VIDEO) && PLATFORM(IOS)
-
-#import "MediaPlayerPrivateIOS.h"
-
-#import "GraphicsLayerCA.h"
-#import "InbandTextTrackPrivateAVFIOS.h"
-#import "Logging.h"
-#import "PlatformTextTrack.h"
-#import "TextTrackRepresentation.h"
-#import "TimeRanges.h"
-#import "URL.h"
-#import "WAKAppKitStubs.h"
-#import "WebCoreThreadRun.h"
-#import <CoreGraphics/CoreGraphics.h>
-#import <wtf/NeverDestroyed.h>
-#import <wtf/StdLibExtras.h>
-
-using namespace WebCore;
-using namespace std;
-
-@interface WebCoreMediaPlayerNotificationHelper : NSObject
-{
-    MediaPlayerPrivateIOS* _client;
-    BOOL _deferredPropertiesScheduled;
-}
-- (id)initWithClient:(MediaPlayerPrivateIOS *)client;
-- (void)disconnect;
-- (void)cancelPendingRequests;
-- (void)delayNotification:(int)notification;
-- (void)deliverNotification:(NSNumber *)notification;
-- (void)schedulePrepareToPlayWithOptionalDelay:(NSNumber *)shouldDelay;
-- (void)scheduleDeferredPropertiesWithOptionalDelay:(NSNumber *)shouldDelay;
-
-- (void)pluginElementInBandAlternateTextTracksDidChange:(NSArray *)tracks;
-- (void)pluginElementDidSelectTextTrack:(NSString *)trackId;
-- (void)pluginElementDidOutputAttributedStrings:(NSArray *)strings nativeSampleBuffers:(NSArray *)buffers forTime:(NSTimeInterval)time;
-@end
-
-// Private selectors implemented by the media player proxy object returned by the plug-in.
-@interface NSObject (WebMediaPlayerProxy_Extras)
-- (void)_attributeChanged:(NSString *)name value:(NSString *)value;
-- (BOOL)_readyForPlayback;
-@end
-
-namespace WebCore {
-
-const int kRequiredHelperInterfaceVersion = 1;
-
-static NSString * const DeferredPropertyControlsKey = @"controls";
-static NSString * const DeferredPropertyPosterKey = @"poster";
-static NSString * const DeferredPropertySrcKey = @"src";
-static NSString * const DeferredPlayKey = @"play";
-static NSString * const DeferredPropertySelectedTrackKey = @"selectedtrack";
-static NSString * const DeferredPropertyOutOfBandTracksKey = @"outofbandtracks";
-#if ENABLE(IOS_AIRPLAY)
-static NSString * const DeferredWirelessVideoPlaybackDisabled = @"wirelessVideoPlaybackDisabled";
-#endif
-
-static NSString * const TextTrackDisplayNameKey = @"displayname";
-static NSString * const TextTrackLocaleIdentifierKey = @"localeidentifier";
-static NSString * const TextTrackSubtitlesKey = @"subtitles";
-static NSString * const TextTrackCaptionsKey = @"captions";
-static NSString * const TextTrackTypeKey = @"type";
-static NSString * const TextTrackIDKey = @"id";
-
-const int TextTrackOffMenuItemID = -1;
-const int TextTrackAutoMenuItemID = -2;
-
-MediaPlayerPrivateIOS::PlatformTextTrackMenuInterfaceIOS::PlatformTextTrackMenuInterfaceIOS(MediaPlayerPrivateIOS* owner)
-    : m_client(nullptr)
-    , m_owner(owner)
-{
-}
-        
-MediaPlayerPrivateIOS::PlatformTextTrackMenuInterfaceIOS::~PlatformTextTrackMenuInterfaceIOS()
-{
-    m_owner = nullptr;
-    m_client = nullptr;
-}
-
-PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateIOS::create(MediaPlayer* player)
-{ 
-    return adoptPtr(new MediaPlayerPrivateIOS(player));
-}
-
-void MediaPlayerPrivateIOS::registerMediaEngine(MediaEngineRegistrar registrar)
-{
-    if (isAvailable())
-        registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
-}
-
-MediaPlayerPrivateIOS::MediaPlayerPrivateIOS(MediaPlayer* player)
-    : m_mediaPlayer(player)
-    , m_objcHelper(adoptNS([[WebCoreMediaPlayerNotificationHelper alloc] initWithClient:this]))
-    , m_networkState(MediaPlayer::Empty)
-    , m_readyState(MediaPlayer::HaveNothing)
-#if ENABLE(VIDEO_TRACK)
-    , m_currentTrack(nullptr)
-#endif
-    , m_delayCallbacks(0)
-    , m_changingVolume(0)
-    , m_bytesLoadedAtLastDidLoadingProgress(0)
-    , m_requestedRate(0)
-    , m_bufferingState(Empty)
-    , m_visible(false)
-    , m_usingNetwork(false)
-    , m_inFullScreen(false)
-    , m_shouldPrepareToPlay(false)
-    , m_preparingToPlay(false)
-    , m_pauseRequested(false)
-{
-}
-
-MediaPlayerPrivateIOS::~MediaPlayerPrivateIOS()
-{
-    clearTextTracks();
-    [m_objcHelper.get() disconnect];
-    if ([m_mediaPlayerHelper.get() respondsToSelector:@selector(_setDelegate:)])
-        [m_mediaPlayerHelper.get() _setDelegate:nil];
-    [m_mediaPlayerHelper.get() _disconnect];
-}
-
-void MediaPlayerPrivateIOS::setMediaPlayerProxy(WebMediaPlayerProxy *proxy)
-{
-    if (m_mediaPlayerHelper)
-        [m_mediaPlayerHelper.get() _disconnect];
-
-    m_mediaPlayerHelper = nullptr;
-
-    if (proxy) {
-        // don't try to use a helper if the interface version is too low
-        if ([proxy _interfaceVersion] <  kRequiredHelperInterfaceVersion) {
-            NSLog(@"Media player helper interface version too low, exiting.");
-            return;
-        }
-        m_mediaPlayerHelper = adoptNS(static_cast<NSObject *>([proxy retain]));
-        if ([m_mediaPlayerHelper.get() respondsToSelector:@selector(_setDelegate:)])
-            [m_mediaPlayerHelper.get() _setDelegate:m_objcHelper.get()];
-
-        acceleratedRenderingStateChanged();
-    }
-
-    processPendingRequests();
-}
-
-void MediaPlayerPrivateIOS::load(const String& url)
-{
-    NSURL *nsURL = URL(ParsedURLString, url);
-
-    if (!m_mediaPlayerHelper) {
-        addDeferredRequest(DeferredPropertySrcKey, [nsURL absoluteString]);
-        return;
-    }
-
-    [m_deferredProperties.get() removeObjectForKey:DeferredPropertySrcKey];
-    setDelayCallbacks(true);
-    {
-        if (m_networkState != MediaPlayer::Loading) {
-            m_networkState = MediaPlayer::Loading;
-            m_mediaPlayer->networkStateChanged();
-        }
-        if (m_readyState != MediaPlayer::HaveNothing) {
-            m_readyState = MediaPlayer::HaveNothing;
-            m_mediaPlayer->readyStateChanged();
-        }
-
-        m_pauseRequested = false;
-        m_preparingToPlay = false;
-
-        [m_mediaPlayerHelper.get() _cancelLoad];
-        [m_mediaPlayerHelper.get() _load:nsURL];
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::cancelLoad()
-{
-    [m_objcHelper.get() cancelPendingRequests];
-    [m_deferredProperties.get() removeAllObjects];
-
-    if (!m_mediaPlayerHelper)
-        return;
-    [m_mediaPlayerHelper.get() _cancelLoad];
-}
-
-void MediaPlayerPrivateIOS::addDeferredRequest(NSString *name, id value)
-{
-    if (!m_deferredProperties)
-        m_deferredProperties = adoptNS([[NSMutableDictionary alloc] init]);
-    [m_deferredProperties.get() setObject:value ? value : @"" forKey:name];
-}
-
-void MediaPlayerPrivateIOS::processDeferredRequests()
-{
-    if (![m_deferredProperties.get() count])
-        return;
-
-    setDelayCallbacks(true);
-    {
-        RetainPtr<NSDictionary> localProperties = adoptNS([[NSDictionary alloc] initWithDictionary:m_deferredProperties.get()]);
-        [m_deferredProperties.get() removeAllObjects];
-
-        // Always set the src first.
-        id value = [localProperties.get() objectForKey:DeferredPropertySrcKey];
-        if (value)
-            load(value);
-
-        for (NSString *name in localProperties.get()) {
-            value = [localProperties.get() objectForKey:name];
-
-            LOG(Media, "MediaPlayerPrivateIOS::processDeferredRequests(%p) - processing %s", this, [name UTF8String]);
-
-            if ([name isEqualToString:DeferredPropertyPosterKey])
-                setPoster(value);
-            else if ([name isEqualToString:DeferredPropertyControlsKey])
-                setControls([value boolValue]);
-            else if ([name isEqualToString:DeferredPlayKey])
-                play();
-            else if ([name isEqualToString:DeferredPropertyOutOfBandTracksKey])
-                setOutOfBandTextTracks(value);
-            else if ([name isEqualToString:DeferredPropertySelectedTrackKey])
-                setSelectedTextTrack(value);
-#if ENABLE(IOS_AIRPLAY)
-            else if ([name isEqualToString:DeferredWirelessVideoPlaybackDisabled])
-                setWirelessVideoPlaybackDisabled([value boolValue]);
-#endif
-            else if (![name isEqualToString:DeferredPropertySrcKey])
-                attributeChanged(name, value);
-        }
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::setPoster(const String& url)
-{
-    setDelayCallbacks(true);
-    {
-        NSURL *nsURL = URL(ParsedURLString, url);
-        if (m_mediaPlayerHelper) {
-            [m_deferredProperties.get() removeObjectForKey:DeferredPropertyPosterKey];
-            [m_mediaPlayerHelper.get() _setPoster:nsURL];
-        }
-        else
-            addDeferredRequest(DeferredPropertyPosterKey, url);
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::setControls(bool controls)
-{
-    setDelayCallbacks(true);
-    {
-        if (m_mediaPlayerHelper) {
-            [m_deferredProperties.get() removeObjectForKey:DeferredPropertyControlsKey];
-            [m_mediaPlayerHelper.get() _setControls:controls];
-        }
-        else
-            addDeferredRequest(DeferredPropertyControlsKey, [NSNumber numberWithBool:controls]);
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::processPendingRequests()
-{
-    if (m_shouldPrepareToPlay && !m_preparingToPlay)
-        [m_objcHelper.get() schedulePrepareToPlayWithOptionalDelay:[NSNumber numberWithBool:YES]];
-    if ([m_deferredProperties.get() count])
-        [m_objcHelper.get() scheduleDeferredPropertiesWithOptionalDelay:[NSNumber numberWithBool:YES]];
-    m_shouldPrepareToPlay = false;
-}
-
-void MediaPlayerPrivateIOS::prepareToPlay()
-{
-    if (!m_mediaPlayerHelper) {
-        // Not hooked up to the plug-in yet, remember this request.
-        m_shouldPrepareToPlay = true;
-        return;
-    }
-
-    if (m_preparingToPlay || m_readyState >= MediaPlayer::HaveFutureData)
-        return;
-
-    m_shouldPrepareToPlay = false;
-    m_preparingToPlay = true;
-
-    setDelayCallbacks(true);
-        [m_mediaPlayerHelper.get() _prepareForPlayback];
-    setDelayCallbacks(false);
-}
-
-
-void MediaPlayerPrivateIOS::play()
-{
-    if (!m_mediaPlayerHelper) {
-        addDeferredRequest(DeferredPlayKey, nil);
-        return;
-    }
-
-    m_pauseRequested = false;
-    setDelayCallbacks(true);
-        [m_mediaPlayerHelper.get() _play];
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::pause()
-{
-    if (!m_mediaPlayerHelper)
-        return;
-
-    m_pauseRequested = true;
-    setDelayCallbacks(true);
-        [m_mediaPlayerHelper.get() _pause];
-    setDelayCallbacks(false);
-}
-
-float MediaPlayerPrivateIOS::duration() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0;
-    float duration = static_cast<float>([m_mediaPlayerHelper.get() _duration]);
-    return duration == -1 ? numeric_limits<float>::infinity() : duration;
-}
-
-float MediaPlayerPrivateIOS::currentTime() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0;
-    return static_cast<float>([m_mediaPlayerHelper.get() _currentTime]);
-}
-
-void MediaPlayerPrivateIOS::seek(float time)
-{
-    if (!m_mediaPlayerHelper)
-        return;
-    float duration = this->duration();
-    [m_mediaPlayerHelper.get() _setCurrentTime:(time > duration ? duration : time)];
-}
-
-void MediaPlayerPrivateIOS::setEndTime(float time)
-{
-    if (!m_mediaPlayerHelper)
-        return;
-    [m_mediaPlayerHelper.get() _setEndTime:time];
-}
-
-bool MediaPlayerPrivateIOS::paused() const
-{
-    if (!m_mediaPlayerHelper)
-        return true;
-    return !rate();
-}
-
-bool MediaPlayerPrivateIOS::seeking() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _seeking];
-}
-
-IntSize MediaPlayerPrivateIOS::naturalSize() const
-{
-    if (!m_mediaPlayerHelper)
-        return IntSize();
-
-    NSSize size = [m_mediaPlayerHelper.get() _naturalSize];
-    return IntSize(size);
-}
-
-bool MediaPlayerPrivateIOS::hasVideo() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _hasVideo];
-}
-
-bool MediaPlayerPrivateIOS::hasAudio() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _hasAudio];
-}
-
-float MediaPlayerPrivateIOS::volume() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _volume];
-}
-
-void MediaPlayerPrivateIOS::setVolume(float inVolume)
-{
-    if (!m_mediaPlayerHelper || m_changingVolume)
-        return;
-    [m_mediaPlayerHelper.get() _setVolume:inVolume];
-}
-
-float MediaPlayerPrivateIOS::rate() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _rate];
-}
-
-void MediaPlayerPrivateIOS::setRate(float inRate)
-{
-    if (!m_mediaPlayerHelper)
-        return;
-    m_requestedRate = inRate;
-    [m_mediaPlayerHelper.get() _setRate:inRate];
-}
-
-void MediaPlayerPrivateIOS::setMuted(bool inMute)
-{
-    if (!m_mediaPlayerHelper)
-        return;
-    [m_mediaPlayerHelper.get() _setMuted:inMute];
-}
-
-int MediaPlayerPrivateIOS::dataRate() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0;
-    return [m_mediaPlayerHelper.get() _dataRate];
-}
-
-MediaPlayer::NetworkState MediaPlayerPrivateIOS::networkState() const 
-{ 
-    return m_networkState;
-}
-
-MediaPlayer::ReadyState MediaPlayerPrivateIOS::readyState() const 
-{
-    return m_readyState;
-}
-
-float MediaPlayerPrivateIOS::maxTimeBuffered() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0;
-    return [m_mediaPlayerHelper.get() _maxTimeBuffered];
-}
-
-bool MediaPlayerPrivateIOS::didLoadingProgress() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    unsigned currentBytesLoaded = [m_mediaPlayerHelper.get() _bytesLoaded];
-    bool didLoadingProgress = currentBytesLoaded != m_bytesLoadedAtLastDidLoadingProgress;
-    m_bytesLoadedAtLastDidLoadingProgress = currentBytesLoaded;
-    return didLoadingProgress;
-}
-
-bool MediaPlayerPrivateIOS::totalBytesKnown() const
-{
-    return totalBytes() > 0;
-}
-
-unsigned MediaPlayerPrivateIOS::totalBytes() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0;
-    return [m_mediaPlayerHelper.get() _totalBytes];
-}
-
-float MediaPlayerPrivateIOS::maxTimeSeekable() const
-{
-    if (!m_mediaPlayerHelper)
-        return 0.0f;
-    return [m_mediaPlayerHelper.get() _maxTimeSeekable];
-}
-
-std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateIOS::buffered() const
-{
-    auto timeRanges = PlatformTimeRanges::create();
-
-    if (!m_mediaPlayerHelper)
-        return timeRanges;
-
-    NSArray *ranges = [m_mediaPlayerHelper.get() _bufferedTimeRanges];
-    if (!ranges)
-        return timeRanges;
-
-    float timeRange[2];
-    int count = [ranges count];
-    for (int i = 0; i < count; ++i) {
-        NSData *range = [ranges objectAtIndex:i];
-        [range getBytes:timeRange length:(NSUInteger)sizeof(timeRange)];
-
-        timeRanges->add(timeRange[0], timeRange[1]);
-    }
-
-    return timeRanges;
-}
-
-void MediaPlayerPrivateIOS::setSize(const IntSize&)
-{
-    // FIXME: Do we need to do anything here?
-}
-
-void MediaPlayerPrivateIOS::setVisible(bool visible)
-{
-    // FIXME: Do we need to do anything more here?
-    if (m_visible != visible)
-        m_visible = visible;
-}
-
-void MediaPlayerPrivateIOS::paint(GraphicsContext*, const IntRect&)
-{
-    // Nothing to do here.
-}
-
-static HashSet<String> mimeTypeCache()
-{
-    static NeverDestroyed<HashSet<String>> typeCache;
-    static bool typeListInitialized = false;
-
-    if (typeListInitialized)
-        return typeCache;
-
-    typeListInitialized = true;
-
-    // FIXME: Should get these from the helper, but we don't have an instance when this is called.
-    static const char* typeList[] = {
-        "application/x-mpegurl",
-        "application/vnd.apple.mpegurl",
-        "audio/3gpp",
-        "audio/3gpp2",
-        "audio/aac",
-        "audio/aiff",
-        "audio/amr",
-        "audio/basic",
-        "audio/mp3",
-        "audio/mp4",
-        "audio/mpeg",
-        "audio/mpegurl",
-        "audio/mpeg3",
-        "audio/scpls",
-        "audio/wav",
-        "audio/x-aac",
-        "audio/x-aiff",
-        "audio/x-caf",
-        "audio/x-m4a",
-        "audio/x-m4b",
-        "audio/x-m4p",
-        "audio/x-m4r",
-        "audio/x-mp3",
-        "audio/x-mpeg",
-        "audio/x-mpeg3",
-        "audio/x-mpegurl",
-        "audio/x-scpls",
-        "audio/x-wav",
-        "video/3gpp",
-        "video/3gpp2",
-        "video/mp4",
-        "video/quicktime",
-        "video/x-m4v",
-
-        // FIXME: This is added to restore old behavior for:
-        // <rdar://problem/9792964> Embedded videos don't play on spiegel.de (.html file redirects)
-        // However, a better fix is tracked by:
-        // <http://webkit.org/b/64811> <video> ".html" src with a 301 redirect fails to load
-        "text/html",
-    };
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(typeList); ++i)
-        typeCache.get().add(typeList[i]);
-
-    return typeCache;
-}
-
-MediaPlayer::SupportsType MediaPlayerPrivateIOS::supportsType(const MediaEngineSupportParameters& parameters)
-{
-    // Only return "IsSupported" if there is no codecs parameter for now as there is no way to ask CoreMedia
-    // if it supports an extended MIME type.
-    if (!parameters.type.isEmpty() && mimeTypeCache().contains(parameters.type))
-        return parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
-
-    return MediaPlayer::IsNotSupported;
-}
-
-void MediaPlayerPrivateIOS::getSupportedTypes(HashSet<String>& types)
-{
-    types = mimeTypeCache();
-}
-
-bool MediaPlayerPrivateIOS::isAvailable()
-{
-    return true;
-}
-
-#if ENABLE(IOS_AIRPLAY)
-bool MediaPlayerPrivateIOS::isCurrentPlaybackTargetWireless() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _isCurrentPlaybackTargetWireless];
-}
-
-void MediaPlayerPrivateIOS::showPlaybackTargetPicker()
-{
-    setDelayCallbacks(true);
-        [m_mediaPlayerHelper.get() _showPlaybackTargetPicker];
-    setDelayCallbacks(false);
-}
-
-bool MediaPlayerPrivateIOS::hasWirelessPlaybackTargets() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _hasWirelessPlaybackTargets];
-}
-
-bool MediaPlayerPrivateIOS::wirelessVideoPlaybackDisabled() const
-{
-    if (!m_mediaPlayerHelper)
-        return false;
-    return [m_mediaPlayerHelper.get() _wirelessVideoPlaybackDisabled];
-}
-
-void MediaPlayerPrivateIOS::setWirelessVideoPlaybackDisabled(bool disabled)
-{
-    setDelayCallbacks(true);
-    {
-        if (m_mediaPlayerHelper) {
-            [m_deferredProperties.get() removeObjectForKey:DeferredWirelessVideoPlaybackDisabled];
-            [m_mediaPlayerHelper.get() _setWirelessVideoPlaybackDisabled:disabled];
-        } else
-            addDeferredRequest(DeferredWirelessVideoPlaybackDisabled, [NSNumber numberWithBool:disabled]);
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::setHasPlaybackTargetAvailabilityListeners(bool hasListeners)
-{
-    [m_mediaPlayerHelper.get() _setHasPlaybackTargetAvailabilityListeners:hasListeners];
-}
-#endif
-
-bool MediaPlayerPrivateIOS::supportsAcceleratedRendering() const
-{
-    return true;
-}
-
-void MediaPlayerPrivateIOS::enterFullscreen()
-{
-    // The const cast is a workaround due to OpenSource changing the signature to const.
-    MediaPlayerPrivateIOS* mutableThis = const_cast<MediaPlayerPrivateIOS*>(this);
-    mutableThis->setDelayCallbacks(true);
-    [m_mediaPlayerHelper.get() _enterFullScreen];
-    mutableThis->setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::exitFullscreen()
-{
-    setDelayCallbacks(true);
-    [m_mediaPlayerHelper.get() _exitFullScreen];
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::attributeChanged(const String& name, const String& value)
-{
-    if (!m_mediaPlayerHelper) {
-        addDeferredRequest(name, value);
-        return;
-    }
-
-    if (![m_mediaPlayerHelper.get() respondsToSelector:@selector(_attributeChanged:value:)])
-        return;
-
-    setDelayCallbacks(true);
-    [m_mediaPlayerHelper.get() _attributeChanged:name value:value];
-    setDelayCallbacks(false);
-}
-
-bool MediaPlayerPrivateIOS::readyForPlayback() const
-{
-    if ([m_mediaPlayerHelper.get() respondsToSelector:@selector(_readyForPlayback)])
-        return [m_mediaPlayerHelper.get() _readyForPlayback];
-    return MediaPlayerPrivateInterface::readyForPlayback();
-}
-
-bool MediaPlayerPrivateIOS::hasClosedCaptions() const
-{
-    return [m_mediaPlayerHelper.get() _hasClosedCaptions];
-}    
-
-void MediaPlayerPrivateIOS::setClosedCaptionsVisible(bool flag)
-{
-    [m_mediaPlayerHelper.get() _setClosedCaptionsVisible:flag];
-}
-
-void MediaPlayerPrivateIOS::deliverNotification(MediaPlayerProxyNotificationType notification) 
-{
-    LOG(Media, "MediaPlayerPrivateIOS::deliverNotification(%p) - notification = %i, entering with networkState = %i, readyState = %i", 
-        this, static_cast<int>(notification), static_cast<int>(m_networkState), static_cast<int>(m_readyState));
-
-    if (!m_mediaPlayer)
-        return;
-
-    if (callbacksDelayed()) {
-        [m_objcHelper.get() delayNotification:notification];
-        return;
-    }
-
-    MediaPlayer::NetworkState oldNetworkState = m_networkState;
-    MediaPlayer::ReadyState oldReadyState = m_readyState;
-
-    switch (notification) {
-    case MediaPlayerNotificationStartUsingNetwork:
-        m_usingNetwork = true;
-        if (m_networkState < MediaPlayer::Loading)
-            m_networkState = MediaPlayer::Loading;
-        break;
-    case MediaPlayerNotificationStopUsingNetwork:
-        m_usingNetwork = false;
-        if (m_readyState < MediaPlayer::HaveCurrentData && m_networkState < MediaPlayer::FormatError)
-            m_networkState = MediaPlayer::Idle;
-        break;
-
-    case MediaPlayerNotificationGainFocus:
-        if (m_networkState < MediaPlayer::Loading)
-            m_networkState = MediaPlayer::Loading;
-        break;
-
-    case MediaPlayerNotificationLoseFocus:
-        if (m_networkState < MediaPlayer::FormatError)
-            m_networkState = MediaPlayer::Idle;
-        if (m_readyState > MediaPlayer::HaveMetadata)
-            m_readyState = MediaPlayer::HaveMetadata;
-        break;
-
-    case MediaPlayerNotificationEnteredFullscreen:
-        m_inFullScreen = true;
-        break;
-
-    case MediaPlayerNotificationExitedFullscreen: {
-        m_inFullScreen = false;
-#if ENABLE(VIDEO_TRACK)
-        setTextTrackRepresentation(0);
-#endif
-        break;
-    }
-
-    case MediaPlayerNotificationReadyForInspection:
-        // The buffering state sometimes reaches "likely to keep up" or "full" before the player item is
-        // ready for inspection. In that case advance directly to HaveEnoughData.
-        if (m_bufferingState > UnlikeleyToKeepUp)
-            m_readyState = MediaPlayer::HaveEnoughData;
-        else
-            m_readyState = MediaPlayer::HaveCurrentData;
-        break;
-
-    case MediaPlayerNotificationMediaValidated:
-        if (m_networkState < MediaPlayer::Idle && !m_preparingToPlay)
-            m_networkState = MediaPlayer::Idle;
-        processPendingRequests();
-        break;
-
-    case MediaPlayerNotificationMediaFailedToValidate:
-        m_networkState = MediaPlayer::FormatError;
-        m_readyState = MediaPlayer::HaveNothing; 
-        m_usingNetwork = false;
-        m_preparingToPlay = false;
-        break;
-
-    case MediaPlayerNotificationPlaybackFailed: {
-        // FIXME: We can't currently tell the difference between NetworkError and DecodeError.
-        m_networkState = MediaPlayer::DecodeError;
-
-        // Don't reset readyState, what we have loaded already may be playable.
-        m_usingNetwork = false;
-        break;
-    }
-
-    case MediaPlayerNotificationReadyForPlayback:
-        if (m_networkState < MediaPlayer::Loading)
-            m_networkState = MediaPlayer::Loading;
-        m_readyState = MediaPlayer::HaveFutureData;
-        break;
-
-    case MediaPlayerNotificationDidPlayToTheEnd:
-        m_mediaPlayer->timeChanged();
-        break;
-
-    case MediaPlayerNotificationStreamLikelyToKeepUp:
-        if (m_networkState < MediaPlayer::Loading)
-            m_networkState = MediaPlayer::Loading;
-        if (m_readyState > MediaPlayer::HaveMetadata && m_readyState < MediaPlayer::HaveEnoughData)
-            m_readyState = MediaPlayer::HaveEnoughData;
-        m_bufferingState = LikeleyToKeepUp;
-        break;
-
-    case MediaPlayerNotificationStreamBufferFull:
-        // The media buffers are full so no more data can be loaded. This isn't really the the same thing as 
-        // "HaveFutureData", but nothing more will be loaded until playback consumes some of the buffered data
-        // so bump the readyState to allow playback.
-        if (m_readyState > MediaPlayer::HaveMetadata && m_readyState < MediaPlayer::HaveEnoughData)
-            m_readyState = MediaPlayer::HaveFutureData;
-        m_networkState = MediaPlayer::Idle;
-        m_bufferingState = Full;
-        break;
-
-    case MediaPlayerNotificationStreamRanDry:
-        m_networkState = MediaPlayer::Loading;
-        if (m_readyState > MediaPlayer::HaveMetadata)
-            m_readyState = MediaPlayer::HaveCurrentData;
-        m_bufferingState = Empty;
-        break;
-
-    case MediaPlayerNotificationStreamUnlikelyToKeepUp:
-        m_networkState = MediaPlayer::Loading;
-        if (m_readyState > MediaPlayer::HaveMetadata && m_readyState < MediaPlayer::HaveEnoughData)
-            m_readyState = MediaPlayer::HaveFutureData;
-        m_bufferingState = UnlikeleyToKeepUp;
-        break;
-
-    case MediaPlayerNotificationFileLoaded:
-        m_networkState = MediaPlayer::Loaded;
-        m_readyState = MediaPlayer::HaveEnoughData;
-        break;
-
-    case MediaPlayerNotificationTimeJumped:
-        // Sometimes get a spurious "time jumped" when the movie is being set up or immediately after pausing, 
-        // don't fall for it.
-        if (m_readyState >= MediaPlayer::HaveCurrentData)
-            m_mediaPlayer->timeChanged();
-        break;
-
-    case MediaPlayerNotificationMutedDidChange:
-    case MediaPlayerNotificationVolumeDidChange:
-        ++m_changingVolume;
-        m_mediaPlayer->volumeChanged(volume());
-        --m_changingVolume;
-        break;
-
-    case MediaPlayerNotificationSizeDidChange:
-        break;
-
-    case MediaPlayerNotificationPlayPauseButtonPressed:
-    case MediaPlayerRequestBeginPlayback:
-    case MediaPlayerRequestPausePlayback:
-        break;
-
-    case MediaPlayerNotificationRateDidChange:
-        m_preparingToPlay = false;
-        if (m_pauseRequested && rate())
-            m_pauseRequested = false;
-        break;
-
-#if ENABLE(IOS_AIRPLAY)
-    case MediaPlayerNotificationCurrentPlaybackTargetIsWirelessChanged:
-        m_mediaPlayer->currentPlaybackTargetIsWirelessChanged();
-        break;
-
-    case MediaPlayerNotificationPlaybackTargetAvailabilityChanged:
-        m_mediaPlayer->playbackTargetAvailabilityChanged();
-        break;
-#endif
-    }
-
-    if (m_networkState != oldNetworkState)
-        m_mediaPlayer->networkStateChanged();
-    if (m_readyState != oldReadyState)
-        m_mediaPlayer->readyStateChanged();
-
-    LOG(Media, "MediaPlayerPrivateIOS::deliverNotification(%p) - exiting with networkState = %i, readyState = %i", 
-        this, static_cast<int>(m_networkState), static_cast<int>(m_readyState));
-}
-
-#if ENABLE(VIDEO_TRACK)
-bool MediaPlayerPrivateIOS::requiresTextTrackRepresentation() const
-{
-    return m_inFullScreen;
-}
-
-void MediaPlayerPrivateIOS::setTextTrackRepresentation(TextTrackRepresentation* representation)
-{
-    [m_mediaPlayerHelper.get() _setTextTrackRepresentation:representation ? representation->platformLayer() : nullptr];
-}
-
-void MediaPlayerPrivateIOS::inbandTextTracksChanged(NSArray *tracks)
-{
-    Vector<RefPtr<InbandTextTrackPrivateAVFIOS> > removedTextTracks = m_textTracks;
-
-    for (NSDictionary *trackInfo in tracks) {
-        bool newTrack = true;
-        NSNumber *trackIDValue  = [trackInfo objectForKey:TextTrackIDKey];
-
-        if (![trackIDValue isKindOfClass:[NSNumber class]]) {
-            NSLog(@"Unexpected track ID, ignoring.");
-            continue;
-        }
-
-        int trackID = [trackIDValue intValue];
-        for (unsigned i = removedTextTracks.size(); i > 0; --i) {
-            RefPtr<InbandTextTrackPrivateAVFIOS> track = static_cast<InbandTextTrackPrivateAVFIOS*>(removedTextTracks[i - 1].get());
-
-            if (track->internalID() == trackID) {
-                removedTextTracks.remove(i - 1);
-                newTrack = false;
-                break;
-            }
-        }
-        if (!newTrack)
-            continue;
-
-        NSString *name = [trackInfo objectForKey:TextTrackDisplayNameKey];
-        NSString *language = [trackInfo objectForKey:TextTrackLocaleIdentifierKey];
-        NSString *type = [trackInfo objectForKey:TextTrackTypeKey];
-
-        LOG(Media, "MediaPlayerPrivateIOS::inbandTextTracksChanged(%p) - adding track id %i, name = %s, language = %s, type = %s", this, trackID, [name UTF8String], [language UTF8String], [type UTF8String]);
-
-        m_textTracks.append(InbandTextTrackPrivateAVFIOS::create(this, trackID, name, language, type));
-    }
-
-    if (removedTextTracks.size()) {
-        for (unsigned i = m_textTracks.size(); i > 0; --i) {
-            RefPtr<InbandTextTrackPrivateAVFIOS> track = static_cast<InbandTextTrackPrivateAVFIOS*>(m_textTracks[i - 1].get());
-
-            if (!removedTextTracks.contains(track))
-                continue;
-
-            if (m_currentTrack == track.get())
-                m_currentTrack = nullptr;
-            m_mediaPlayer->removeTextTrack(track);
-            m_textTracks.remove(i - 1);
-        }
-    }
-
-    for (unsigned i = 0; i < m_textTracks.size(); ++i) {
-        RefPtr<InbandTextTrackPrivateAVFIOS> track = static_cast<InbandTextTrackPrivateAVFIOS*>(m_textTracks[i].get());
-
-        track->setTextTrackIndex(i);
-        if (track->hasBeenReported())
-            continue;
-
-        track->setHasBeenReported(true);
-        m_mediaPlayer->addTextTrack(track.get());
-    }
-    LOG(Media, "MediaPlayerPrivateIOS::inbandTextTracksChanged(%p) - found %i in-band tracks", this, m_textTracks.size());
-}
-
-void MediaPlayerPrivateIOS::setSelectedTextTrack(NSNumber *trackID)
-{
-    if (![trackID isKindOfClass:[NSNumber class]]) {
-        NSLog(@"Unexpected track ID, ignoring.");
-        return;
-    }
-
-    if (!m_mediaPlayerHelper) {
-        addDeferredRequest(DeferredPropertySelectedTrackKey, trackID);
-        return;
-    }
-
-    if (![m_mediaPlayerHelper.get() respondsToSelector:@selector(_setSelectedTextTrack:)])
-        return;
-
-    setDelayCallbacks(true);
-    {
-        LOG(Media, "MediaPlayerPrivateIOS::setSelectedTextTrack(%p) - selecting track id %i", this, [trackID intValue]);
-        [m_deferredProperties.get() removeObjectForKey:DeferredPropertySelectedTrackKey];
-        [m_mediaPlayerHelper.get() _setSelectedTextTrack:trackID];
-    }
-    setDelayCallbacks(false);
-}
-
-void MediaPlayerPrivateIOS::trackModeChanged()
-{
-    RefPtr<InbandTextTrackPrivateAVF> trackToEnable;
-
-    // AVFoundation can only emit cues for one track at a time, so enable the first track that is showing, or the first that
-    // is hidden if none are showing. Otherwise disable all tracks.
-    for (unsigned i = 0; i < m_textTracks.size(); ++i) {
-        RefPtr<InbandTextTrackPrivateAVFIOS> track = m_textTracks[i];
-        if (track->mode() == InbandTextTrackPrivate::Showing) {
-            trackToEnable = track;
-            break;
-        }
-        if (!trackToEnable && track->mode() == InbandTextTrackPrivate::Hidden)
-            trackToEnable = track;
-    }
-
-    InbandTextTrackPrivateAVFIOS* trackPrivate = static_cast<InbandTextTrackPrivateAVFIOS*>(trackToEnable.get());
-    if (m_currentTrack == trackPrivate)
-        return;
-
-    m_currentTrack = trackPrivate;
-    setSelectedTextTrack(trackPrivate ? [NSNumber numberWithInt:trackPrivate->internalID()] : nil);
-}
-
-void MediaPlayerPrivateIOS::clearTextTracks()
-{
-    m_currentTrack = nullptr;
-    for (unsigned i = 0; i < m_textTracks.size(); ++i) {
-        RefPtr<InbandTextTrackPrivateAVFIOS> track = m_textTracks[i];
-        m_mediaPlayer->removeTextTrack(track);
-        track->disconnect();
-    }
-    m_textTracks.clear();
-}
-
-void MediaPlayerPrivateIOS::processInbandTextTrackCue(NSArray *attributedStrings, double time)
-{
-    if (!m_currentTrack)
-        return;
-
-    m_currentTrack->processCue(reinterpret_cast<CFArrayRef>(attributedStrings), time);
-}
-
-void MediaPlayerPrivateIOS::setOutOfBandTextTracks(NSArray *tracksArray)
-{
-    if (!m_mediaPlayerHelper) {
-        addDeferredRequest(DeferredPropertyOutOfBandTracksKey, tracksArray);
-        return;
-    }
-
-    if (![m_mediaPlayerHelper.get() respondsToSelector:@selector(_setOutOfBandTextTracks:)])
-        return;
-
-    setDelayCallbacks(true);
-    {
-        [m_deferredProperties.get() removeObjectForKey:DeferredPropertyOutOfBandTracksKey];
-        [m_mediaPlayerHelper.get() _setOutOfBandTextTracks:tracksArray];
-    }
-    setDelayCallbacks(false);
-}
-
-static int platformTrackID(PlatformTextTrack* platformTrack)
-{
-    if (platformTrack->type() == PlatformTextTrack::InBand) {
-        InbandTextTrackPrivateAVFIOS* trackPrivate = static_cast<InbandTextTrackPrivateAVFIOS*>(platformTrack->client()->privateTrack());
-        return trackPrivate ? trackPrivate->internalID() : 0;
-    }
-
-    return platformTrack->uniqueId();
-}
-
-void MediaPlayerPrivateIOS::outOfBandTextTracksChanged()
-{
-    if (!m_menuInterface->client())
-        return;
-
-    RetainPtr<NSMutableArray> tracksArray = adoptNS([[NSMutableArray alloc] init]);
-    Vector<RefPtr<PlatformTextTrack> > textTracks = m_menuInterface->client()->platformTextTracks();
-
-    for (unsigned i = 0; i < textTracks.size(); ++i) {
-        RefPtr<PlatformTextTrack> platformTrack = textTracks[i];
-
-        if (platformTrack->type() == PlatformTextTrack::InBand)
-            continue;
-        if (platformTrack->kind() != PlatformTextTrack::Subtitle && platformTrack->kind() != PlatformTextTrack::Caption)
-            continue;
-
-        RetainPtr<NSMutableDictionary> track = adoptNS([[NSMutableDictionary alloc] init]);
-
-        [track.get() setObject:platformTrack->label() forKey:TextTrackDisplayNameKey];
-
-        if (!platformTrack->language().isEmpty())
-            [track.get() setObject:platformTrack->language() forKey:TextTrackLocaleIdentifierKey];
-
-        NSString *type = platformTrack->kind() == PlatformTextTrack::Subtitle ? TextTrackSubtitlesKey : TextTrackCaptionsKey;
-        [track.get() setObject:type forKey:TextTrackTypeKey];
-
-        [track.get() setObject:[NSNumber numberWithInt:platformTrackID(platformTrack.get())] forKey:TextTrackIDKey];
-
-        [tracksArray addObject:track.get()];
-    }
-
-    if (![tracksArray.get() count])
-        return;
-
-    setOutOfBandTextTracks(tracksArray.get());
-}
-
-void MediaPlayerPrivateIOS::textTrackWasSelectedByMediaElement(PassRefPtr<PlatformTextTrack> platformTrack)
-{
-    setSelectedTextTrack([NSNumber numberWithInt:platformTrackID(platformTrack.get())]);
-}
-
-void MediaPlayerPrivateIOS::textTrackWasSelectedByPlugin(NSDictionary *trackInfo)
-{
-    if (!m_menuInterface || !m_menuInterface->client())
-        return;
-
-    if (!trackInfo) {
-        m_menuInterface->client()->setSelectedTextTrack(0);
-        return;
-    }
-
-    RefPtr<PlatformTextTrack> trackToSelect;
-    NSNumber *trackIDToSelect  = [trackInfo objectForKey:TextTrackIDKey];
-    if (![trackIDToSelect isKindOfClass:[NSNumber class]]) {
-        NSLog(@"Unexpected track ID, ignoring.");
-        return;
-    }
-
-    int trackID = [trackIDToSelect intValue];
-    if (trackID == TextTrackOffMenuItemID)
-        trackToSelect = PlatformTextTrack::captionMenuOffItem();
-    else if (trackID == TextTrackAutoMenuItemID)
-        trackToSelect = PlatformTextTrack::captionMenuAutomaticItem();
-    else {
-        Vector<RefPtr<PlatformTextTrack> > textTracks = m_menuInterface->client()->platformTextTracks();
-        for (unsigned i = 0; i < textTracks.size(); ++i) {
-            RefPtr<PlatformTextTrack> platformTrack = textTracks[i];
-
-            if (trackID == platformTrackID(platformTrack.get())) {
-                trackToSelect = platformTrack;
-                break;
-            }
-        }
-    }
-
-    if (!trackToSelect) {
-        NSLog(@"Text track ID %i is unknown, ignoring.", trackID);
-        return;
-    }
-
-    m_menuInterface->client()->setSelectedTextTrack(trackToSelect);
-}
-
-PassRefPtr<PlatformTextTrackMenuInterface> MediaPlayerPrivateIOS::textTrackMenu()
-{
-    if (!m_menuInterface)
-        m_menuInterface = PlatformTextTrackMenuInterfaceIOS::create(this);
-    return m_menuInterface;
-}
-#endif // ENABLE(VIDEO_TRACK)
-
-} // namespace WebCore
-
-@implementation WebCoreMediaPlayerNotificationHelper
-
-- (id)initWithClient:(MediaPlayerPrivateIOS *)client
-{
-    _client = client;
-    return [super init];
-}
-
-- (void)disconnect
-{
-    [NSObject cancelPreviousPerformRequestsWithTarget:self];
-    _client = 0;
-}
-
-- (void)cancelPendingRequests
-{
-    [NSObject cancelPreviousPerformRequestsWithTarget:self];
-}
-
-- (void)delayNotification:(int)notification
-{
-    if (_client)
-        [self performSelector:@selector(deliverNotification:) withObject:[NSNumber numberWithInt:notification] afterDelay:0];
-}
-
-- (void)deliverNotification:(NSNumber *)notification
-{
-    if (!_client)
-        return;
-    if (_client->callbacksDelayed())
-        [self delayNotification:[notification intValue]];
-    else
-        _client->deliverNotification((MediaPlayerProxyNotificationType)[notification intValue]);
-}
-
-- (void)schedulePrepareToPlayWithOptionalDelay:(NSNumber *)shouldDelay
-{
-    if (!_client)
-        return;
-    if ([shouldDelay boolValue])
-        [self performSelector:@selector(schedulePrepareToPlayWithOptionalDelay:) withObject:[NSNumber numberWithBool:NO] afterDelay:0];
-    else
-        _client->prepareToPlay();
-}
-
-- (void)scheduleDeferredPropertiesWithOptionalDelay:(NSNumber *)shouldDelay
-{
-    if (!_client)
-        return;
-
-    if ([shouldDelay boolValue]) {
-        if (!_deferredPropertiesScheduled) {
-            [self performSelector:@selector(scheduleDeferredPropertiesWithOptionalDelay:) withObject:[NSNumber numberWithBool:NO] afterDelay:0];
-            _deferredPropertiesScheduled = YES;
-        }
-        return;
-    }
-
-    _deferredPropertiesScheduled = NO;
-    _client->processDeferredRequests();
-}
-
-- (void)pluginElementInBandAlternateTextTracksDidChange:(NSArray *)tracks
-{
-    if (!_client)
-        return;
-
-    WebThreadRun(^{
-        if (!_client)
-            return;
-        _client->inbandTextTracksChanged(tracks);
-    });
-}
-
-- (void)pluginElementDidSelectTextTrack:(NSDictionary *)trackInfo
-{
-    if (!_client)
-        return;
-
-    WebThreadRun(^{
-        if (!_client)
-            return;
-        _client->textTrackWasSelectedByPlugin(trackInfo);
-    });
-}
-
-- (void)pluginElementDidOutputAttributedStrings:(NSArray *)strings nativeSampleBuffers:(NSArray *)buffers forTime:(NSTimeInterval)time
-{
-    UNUSED_PARAM(buffers);
-
-    if (!_client)
-        return;
-
-    WebThreadRun(^{
-        if (!_client)
-            return;
-        _client->processInbandTextTrackCue(strings, time);
-    });
-}
-
-@end
-
-#endif