2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-07-02 11:33:24 -04:00
|
|
|
#include "GameLiveStreamingModule.h"
|
|
|
|
|
#include "QueryLiveStreamsCallbackProxy.h"
|
|
|
|
|
#include "Runtime/Engine/Public/Features/ILiveStreamingService.h"
|
2014-07-03 04:42:27 -04:00
|
|
|
#include "IGameLiveStreaming.h"
|
2014-07-02 11:33:24 -04:00
|
|
|
|
2014-10-14 10:29:11 -04:00
|
|
|
UQueryLiveStreamsCallbackProxy::UQueryLiveStreamsCallbackProxy( const FObjectInitializer& ObjectInitializer )
|
|
|
|
|
: Super(ObjectInitializer)
|
2014-07-02 11:33:24 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ) )
|
|
|
|
|
);
|
|
|
|
|
}
|