Unity Rewarded Video Integration

Integrate Rewarded Video

Plug in Your Rewarded Video Profile

Launching a rewarded video requires at least three parameters or data points: your publisher ID, the profile ID associated with a Rewarded Video profile that you have created, and the unique ID of the user who will be watching the rewarded video.

You can get your profile ID and publisher ID after setting up your Rewarded Video profile.


Showing the Rewarded Video

Before proceeding make sure you have imported our Unity plugin in your project.

To display a rewarded video, call the method AdscendMedia.PlayRewardedVideo with the values you gathered above for Publisher ID and Profile ID, along with the end user's unique ID for subId1 in the following manner:

string publisherId = "32740";
string profileId = "365";
string subId1 = "demo_subid1";

//you cannot pass anything but the internal property 'name' as first parameter otherwise callbacks won't work
AdscendMedia.PlayRewardedVideo (name, publisherId, profileId, subId1);

Detecting Video Completion

In addition to the postback we make when the video is watched, the following example will show how to detect the end of the video play so you can then visually credit the user in your application, show a message or complete any other action that you may want to when the video is completed.

Make sure you passed the object property name as the first parameter to the above method call otherwise you will not receive callbacks.

For iOS

public void userWasCredited()
{
    Debug.Log ("User Credited For Watching a Rewarded Video");
}

public void userWasNotCredited()
{
    Debug.Log ("User Not Credited For Watching a Rewarded Video");
}

//If the rewarded video fails to get the video data or there is an internet connection problem, you would receive the callbacks in the following interface method.
public void onFailure(string failureMsg)
{
   Debug.Log ("Rewarded Video failure ->"+failureMsg );
}

For Android

public void onSuccess(string message)
{
  Debug.Log ("Rewarded Video data available response success ->" + message);
}

//If the rewarded video fails to get the video data or there is an internet connection problem, you would receive the callbacks in the following interface method.
public void onFailure(string failureMsg)
{
  Debug.Log ("Rewarded Video failure ->"+failureMsg );
}

public void onError(int errorCode)
{
  Debug.Log ("Media player error ->"+ errorCode);
}

public void onRerwarded()
{
  Debug.Log ("User Credited For Watching a Rewarded Video ->");
}

public void onClosed()
{
  Debug.Log ("Media player closed ->");
}

In the downloaded SDK you will also find a sample Unity project showing how to integrate our Rewarded Video.

Rate Limiting Users

To limit a user's ability to watch rewarded videos to a certain number of times, it is best to maintain an external counter and hide the call-to-action after the user has initiated the action a certain number of times.

Need help with your integration?

If you have any questions about integrating our SDK into your project, shoot us an email at:

SDKsupport@adscendmedia.com