std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer(
    HTMLMediaElement& htmlMediaElement,
    const WebMediaPlayerSource& source,
    WebMediaPlayerClient* client) {
  WebLocalFrameImpl* webFrame =
      WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame());

  if (!webFrame || !webFrame->client())
    return nullptr;

  HTMLMediaElementEncryptedMedia& encryptedMedia =
      HTMLMediaElementEncryptedMedia::from(htmlMediaElement);
  WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement));
  return wrapUnique(webFrame->client()->createMediaPlayer(
      source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(),
      sinkId));
}
// ---------------------------------------------------------------------------
// CTestDtmf::TestStreamControlL
// ---------------------------------------------------------------------------
//
void CTestDtmf::TestStreamControlL( TDtmfSignalType aSigType )
    {
    TMccNetSettings tempSettings = iNetsettings;
    
    CMccInterfaceStub* stub = CMccInterfaceStub::NewL();
    CleanupStack::PushL( stub );
    CMccInterface* interface = CMccInterface::NewL( *stub );
    CleanupStack::PushL( interface );
    
    TUint32 sessionId;
    User::LeaveIfError( interface->CreateSession( sessionId ) );
    
    TUint32 linkId;
    TInt linkType( KMccLinkGeneral );
    User::LeaveIfError( interface->CreateLink( sessionId, linkType, linkId,
        tempSettings ) );
    stub->WaitForEvent( sessionId, linkId, 0, KMccLinkCreated );
    
    CMccCodecInformation* cInfo 
        = FetchCodecByMimeSubtypeNameL( *interface, KTxtDtmf );
    CleanupStack::PushL( cInfo );
    
    if ( aSigType == EInbandSignal )
        {
        cInfo->SetCodecMode( EDTMFModeInband );
        }
    else
        {
        cInfo->SetCodecMode( EDTMFModeEvent );
        }
    
    TUint32 streamId( 0 );
    TUint32 sinkId( 0 ), sourceId( 0 );
    interface->AddDataSink( KMccRtpSinkUid, KNullDesC8, sinkId );
    interface->AddDataSource( KMccRtpSourceUid, KNullDesC8, sourceId );
    
    User::LeaveIfError( interface->CreateStream( sessionId, linkId, streamId,
        KMccDtmfStream, *cInfo ) );
    
    // TEST CORRECT CONTROL PATHS
    User::LeaveIfError ( interface->PrepareStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPrepared );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPrepared );
   
    User::LeaveIfError ( interface->StartStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStarted );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStarted );
    
    User::LeaveIfError ( interface->PauseStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPaused );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPaused );
    
    User::LeaveIfError ( interface->ResumeStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamResumed );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamResumed );
    
    User::LeaveIfError ( interface->StopStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStopped );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStopped );
    
    // TBD: TEST INVALID CONTROL PATHS
    
    User::LeaveIfError( interface->DeleteStream( sessionId, linkId, streamId ) );
    User::LeaveIfError( interface->CloseLink( sessionId, linkId ) );
    User::LeaveIfError( interface->CloseSession( sessionId ) );
    
    CleanupStack::PopAndDestroy( cInfo );
    CleanupStack::PopAndDestroy( interface );
    CleanupStack::PopAndDestroy( stub );
    }