Files
UnrealEngineUWP/Engine/Source/Runtime/GameLiveStreaming/QueryLiveStreamsCallbackProxy.cpp
Mike Fricker 1a24188e92 Live Streaming improvements
- New API for querying a list of existing live stream URLs for any game
- New "QueryLiveStreams" Blueprint node in the "Live Streaming" category (latent)
- Initial API support for sending and receiving online chat messages (no blueprint support yet)
- Fixed broadcasting console commands not unregistered when module is unloaded
- Various code clean-ups

[CL 2124665 by Mike Fricker in Main branch]
2014-07-02 11:33:24 -04:00

50 lines
1.9 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "GameLiveStreamingModule.h"
#include "QueryLiveStreamsCallbackProxy.h"
#include "Runtime/Engine/Public/Features/ILiveStreamingService.h"
UQueryLiveStreamsCallbackProxy::UQueryLiveStreamsCallbackProxy( const FPostConstructInitializeProperties& PCIP )
: Super(PCIP)
{
}
UQueryLiveStreamsCallbackProxy* UQueryLiveStreamsCallbackProxy::QueryLiveStreams( const FString& GameName )
{
UQueryLiveStreamsCallbackProxy* Proxy = NewObject<UQueryLiveStreamsCallbackProxy>();
Proxy->GameName = GameName;
return Proxy;
}
void UQueryLiveStreamsCallbackProxy::Activate()
{
// Query the live streaming system to find out about which live streams are available for the game that was requested. This
// will call back later on with results.
IGameLiveStreaming::Get().GetLiveStreamingService()->QueryLiveStreams(
this->GameName,
ILiveStreamingService::FQueryLiveStreamsCallback::CreateStatic( []( const TArray< FLiveStreamInfo >& LiveStreams, bool bQueryWasSuccessful, TWeakObjectPtr< UQueryLiveStreamsCallbackProxy > WeakThis )
{
// Make sure our UObject hasn't been destroyed at the time that the live streaming system calls back with results
UQueryLiveStreamsCallbackProxy* This = WeakThis.Get();
if( This != nullptr )
{
TArray< FBlueprintLiveStreamInfo > BlueprintLiveStreams;
for( const auto& LiveStream : LiveStreams )
{
FBlueprintLiveStreamInfo& BlueprintLiveStream = *new( BlueprintLiveStreams )FBlueprintLiveStreamInfo;
BlueprintLiveStream.GameName = LiveStream.GameName;
BlueprintLiveStream.StreamName = LiveStream.StreamName;
BlueprintLiveStream.URL = LiveStream.URL;
}
// We have results!
This->OnQueriedLiveStreams.Broadcast( BlueprintLiveStreams, bQueryWasSuccessful );
}
},
TWeakObjectPtr< UQueryLiveStreamsCallbackProxy>( this ) )
);
}