Associated code now uses the API methods that provide isolation from the
internal specifics of the MediaPlayer.
watchVideoForDuration() aborts after two seconds if the video doesn't start
playing which is a compromise to returning immediately, but that's an
exceptional case.
EnduranceStrokes is now protected from trying to stop video on a
potentially null video player.
// When nothing is playing,
// After two seconds,
// Should log message
// Should return
sendMessage("Starting first playback", 0, false);
watchVideoForDuration(30);
sendMessage("Finished first playback", 0, false);
sleep(10);
// When video is longer than required duration,
// After specified duration,
// Should stop video
// Should return
sendMessage("Starting second playback", 0, false);
playVideo(testVideo);
watchVideoForDuration(30);
sendMessage("Finished second playback", 0, false);
sleep(10);
// When video is shorter than required duration,
// After video finishes,
// Should return
sendMessage("Starting third playback", 0, false);
playVideo(testVideo);
watchVideoForDuration(180);
sendMessage("Finished third playback", 0, false);
sleep(10);
Associated code now uses the API methods that provide isolation from the internal specifics of the MediaPlayer.
watchVideoForDuration() aborts after two seconds if the video doesn't start playing which is a compromise to returning immediately, but that's an exceptional case.
EnduranceStrokes is now protected from trying to stop video on a potentially null video player.
Tested with the following script:
" run("../Spicy/Utils/MediaUtils.js"); run("../Spicy/Chat/ChatUtil.js");
const testVideo = "Videos/Spicy/Modules/Cuckold/6.mp4"
// When nothing is playing, // After two seconds, // Should log message // Should return sendMessage("Starting first playback", 0, false); watchVideoForDuration(30); sendMessage("Finished first playback", 0, false); sleep(10);
// When video is longer than required duration, // After specified duration, // Should stop video // Should return sendMessage("Starting second playback", 0, false); playVideo(testVideo); watchVideoForDuration(30); sendMessage("Finished second playback", 0, false); sleep(10);
// When video is shorter than required duration, // After video finishes, // Should return sendMessage("Starting third playback", 0, false); playVideo(testVideo); watchVideoForDuration(180); sendMessage("Finished third playback", 0, false); sleep(10);
sendMessage("Done.", 0, false); "