Ako zobraziť obrázok Jeffa Bezosa v OBS Studio pri spustení Twitch Ads
Tento príklad skriptu prepína obrázok Jeffa Bezosa v OBS Studio, keď sa reklama Twitch spustí a skončí.
Príklad skriptu
import com.squiso.*;
import com.squiso.exception.*;
import com.squiso.scripting.*;
import com.squiso.scripting.data.*;
import com.squiso.keyboard.*;
import com.squiso.twitch.*;
import com.squiso.datatypes.*;
import com.squiso.utils.*;
// Important - Please do not change the row below - otherwise you will get a compilation error!
public class Script_Example extends SquisoScript {
@Override
public void onTwitchAd(OnTwitchAdData data, API api) throws SquisoException {
// Get the ad duration in seconds
SquisoInteger durationSeconds = data.getDuration();
// Specify the OBS scene
SquisoString sceneName = new SquisoString("gaming");
// Specify the OBS scene item
SquisoString itemName = new SquisoString("jeff_bezos");
// Show the scene item
api.setOBSSceneItemVisibility(sceneName, itemName, true);
// Send a chat announcement
SquisoString announcementMessageStarted = new SquisoString("Ads started!");
api.sendTwitchChatAnnouncement(announcementMessageStarted);
// Specify the total time the item should be visible
SquisoInteger waitDuration = new SquisoInteger(durationSeconds.get() * 1000);
api.doLater(waitDuration, () -> {
// Hide the scene item
api.setOBSSceneItemVisibility(sceneName, itemName, false);
// Send a chat announcement
SquisoString announcementMessageEnded = new SquisoString("Ads ended!");
api.sendTwitchChatAnnouncement(announcementMessageEnded);
});
}
}