Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Stream Branch to Main Branch #14

Merged
merged 36 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
515fda2
✨ Added Basic Stream Support for Library (Need to Add for Plugin)
PulseBeat02 Sep 23, 2021
639f79c
✨ Fixed Bug in BotConfiguration
PulseBeat02 Sep 23, 2021
dedb78a
✨ Added Stream Support for Plugin (Supposedly Working, Need to Test +…
PulseBeat02 Sep 23, 2021
bedbf94
🐛 Fixed NullPointerException + Changed Message (From Master)
PulseBeat02 Sep 23, 2021
5edc309
🐛 Fixed a Ton of Video Bugs
PulseBeat02 Sep 23, 2021
62c73e7
Merge branch 'stream' of https://github.com/MinecraftMediaLibrary/EzM…
PulseBeat02 Sep 23, 2021
d25e5a0
🐛 Added Support for All youtube-dl Videos!
PulseBeat02 Sep 24, 2021
3b234fc
✨ Worked on Discord Bot
PulseBeat02 Sep 24, 2021
29094c5
✨ Discord Bot Plays Music Now
PulseBeat02 Sep 24, 2021
7c75913
✨ Some Stream Issues... Will Fix Soon
PulseBeat02 Sep 24, 2021
f8b5bc9
Merge branch 'stream' of https://github.com/MinecraftMediaLibrary/EzM…
PulseBeat02 Sep 25, 2021
a3b1761
🐛 One Step Closer to Streams...
PulseBeat02 Sep 25, 2021
81b45be
✨ Experimental Commit
PulseBeat02 Sep 25, 2021
fec1a2f
✨ HTTP Stream Support Works!
PulseBeat02 Sep 25, 2021
6f4e913
✨ Fixed Normal Video Issue
PulseBeat02 Sep 25, 2021
e273ba9
🐛 Fixed Windows Bug + URL Component Bug
PulseBeat02 Sep 26, 2021
14ff9f6
✨ Removed Unnecessary Class
PulseBeat02 Sep 26, 2021
92566b8
✨ Added Support for More Platforms + Cleaned Up Links
PulseBeat02 Sep 26, 2021
d158eaa
Merge branch 'stream' of https://github.com/MinecraftMediaLibrary/EzM…
PulseBeat02 Sep 26, 2021
0dfab25
✨ Cleaned Up Code
PulseBeat02 Sep 27, 2021
37256bd
✨ Refactored Some Code
PulseBeat02 Sep 27, 2021
702b4d9
✨ Fixed CompletableFuture Bug - Still Many Need to Fix
PulseBeat02 Sep 28, 2021
f912584
🐛 HTTP Live Stream Bug Fixed
PulseBeat02 Sep 29, 2021
5e23422
🐛 Added Thread Dump Command + Properly Released VLC Players
PulseBeat02 Sep 29, 2021
1c76291
🐛 Patched FFmpegMediaPlayer + Linux Support Fixed
PulseBeat02 Sep 30, 2021
db5af6b
🐛 Patched FFmpegMediaPlayer Bug
PulseBeat02 Sep 30, 2021
43ce191
✨ General Logger Improvements
PulseBeat02 Sep 30, 2021
b326724
🐛 Fixed Public Port Issue on Linux
PulseBeat02 Sep 30, 2021
9c93e02
🐛 Fixed Log Output
PulseBeat02 Sep 30, 2021
79a08e3
🐛 Overrided Progress Listener
PulseBeat02 Sep 30, 2021
1856179
✨ Update README.md
PulseBeat02 Oct 1, 2021
9a6a386
🐛 Added Support for Normal Video Playback in HTTP Stream
PulseBeat02 Oct 1, 2021
05a7038
✨ Disallowed Users from Using Buggy Discord Bot Feature
PulseBeat02 Oct 1, 2021
efd543d
Merge branch 'stream' of https://github.com/MinecraftMediaLibrary/EzM…
PulseBeat02 Oct 1, 2021
bea38be
✨ Added Clauses to Switch Statement
PulseBeat02 Oct 1, 2021
fb5106a
✨ Added Licensing
PulseBeat02 Oct 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
✨ Added Stream Support for Plugin (Supposedly Working, Need to Test +…
… Add Discord Support)
  • Loading branch information
PulseBeat02 committed Sep 23, 2021
commit dedb78a7a72232b6bfa87436bc1d9e1a3887fa4e
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ public interface VideoPlayer extends LibraryInjectable, Viewable, Dimensional {
void setCallback(@NotNull final Callback callback);

@NotNull
MrlConfiguration getMrlConfiguration();
MrlConfiguration getDirectVideoMrl();

void setMrlConfiguration(@NotNull final MrlConfiguration configuration);
void setDirectVideoMrl(@NotNull final MrlConfiguration configuration);

@NotNull
MrlConfiguration getDirectAudioMrl();

void setDirectAudioMrl(@NotNull final MrlConfiguration configuration);

@NotNull
FrameConfiguration getFrameConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import io.github.pulsebeat02.ezmediacore.resourcepack.ResourcepackSoundWrapper;
import io.github.pulsebeat02.ezmediacore.resourcepack.hosting.HttpServer;
import io.github.pulsebeat02.ezmediacore.utility.HashingUtils;
import io.github.pulsebeat02.ezmediacore.utility.PathUtils;
import io.github.pulsebeat02.ezmediacore.utility.ResourcepackUtils;
import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -130,7 +129,7 @@ private int playVideo(@NotNull final CommandContext<CommandSender> context) {
case DEBUG_HIGHLIGHTS -> {
if (sender instanceof Player) {
this.attributes.setPlayer(
this.builder.createBlockHighlightPlayer((Player) sender, players));
this.builder.createBlockHighlightPlayer((Player) sender));
} else {
audience.sendMessage(format(text("You must be a player to execute this command!", RED)));
return SINGLE_SUCCESS;
Expand All @@ -156,7 +155,7 @@ private int playVideo(@NotNull final CommandContext<CommandSender> context) {
default -> throw new IllegalArgumentException("Illegal Audio Output!");
}

this.attributes.getPlayer().setPlayerState(PlayerControls.START, MrlConfiguration.ofMrl(this.attributes.getVideoMrl()));
this.attributes.getPlayer().setPlayerState(PlayerControls.START, this.attributes.getVideoMrl());

return SINGLE_SUCCESS;
}
Expand Down Expand Up @@ -191,7 +190,7 @@ private int resumeVideo(@NotNull final CommandContext<CommandSender> context) {
.thenRunAsync(
() ->
ResourcepackUtils.forceResourcepackLoad(
plugin.library(), this.attributes.getUrl(), this.attributes.getHash()))
plugin.library(), this.attributes.getResourcepackUrl(), this.attributes.getResourcepackHash()))
.thenRun(() -> gold(audience, "Resumed the video!"));
return SINGLE_SUCCESS;
}
Expand All @@ -201,7 +200,7 @@ private void buildResourcepack(@NotNull final Audience audience) {
final JavaPlugin loader = plugin.getBootstrap();
try {
final HttpServer server = plugin.getHttpServer();
final Path audio = this.attributes.getAudio();
final Path audio = Path.of(this.attributes.getOggMrl().getMrl());
final Path ogg = audio.getParent().resolve("trimmed.ogg");
final long ms = this.attributes.getPlayer().getElapsedMilliseconds();
plugin.log("Resuming Video at %s Milliseconds!".formatted(ms));
Expand All @@ -214,8 +213,8 @@ private void buildResourcepack(@NotNull final Audience audience) {
wrapper.addSound(loader.getName().toLowerCase(Locale.ROOT), ogg);
wrapper.wrap();
final Path path = wrapper.getResourcepackFilePath();
this.attributes.setUrl(server.createUrl(path));
this.attributes.setHash(HashingUtils.createHashSHA(path).orElseThrow(AssertionError::new));
this.attributes.setResourcepackUrl(server.createUrl(path));
this.attributes.setResourcepackHash(HashingUtils.createHashSHA(path).orElseThrow(AssertionError::new));
Files.delete(audio);
Files.move(ogg, ogg.resolveSibling("audio.ogg"));
} catch (final IOException e) {
Expand All @@ -225,16 +224,16 @@ private void buildResourcepack(@NotNull final Audience audience) {
}

private boolean mediaNotSpecified(@NotNull final Audience audience) {
if (this.attributes.getVideoMrl() == null && !this.attributes.isYoutube()) {
red(audience, "File and URL not specified yet!");
if (this.attributes.getVideoMrl() == null) {
red(audience, "Video not loaded!");
return true;
}
return false;
}

private boolean mediaProcessingIncomplete(@NotNull final Audience audience) {
if (!this.attributes.getCompletion().get()) {
red(audience, "The video is still being processed!");
red(audience, "Video is still processing!");
return true;
}
return false;
Expand All @@ -250,13 +249,9 @@ private void releaseIfPlaying() {
}

private void sendPlayInformation(@NotNull final Audience audience) {
final String mrl = this.attributes.getVideoMrl();
final MrlConfiguration mrl = this.attributes.getVideoMrl();
if (mrl != null) {
if (this.attributes.isYoutube()) {
gold(audience, "Starting Video on URL: %s".formatted(mrl));
} else {
gold(audience, "Starting Video on File: %s".formatted(PathUtils.getName(Path.of(mrl))));
}
gold(audience, "Starting Video on MRL %s".formatted(mrl.getMrl()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import io.github.pulsebeat02.deluxemediaplugin.command.dither.DitherSetting;
import io.github.pulsebeat02.ezmediacore.ffmpeg.EnhancedExecution;
import io.github.pulsebeat02.ezmediacore.player.MrlConfiguration;
import io.github.pulsebeat02.ezmediacore.player.VideoPlayer;
import java.nio.file.Path;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -46,21 +46,21 @@ public final class VideoCommandAttributes {
private DitherSetting dither;
private AudioOutputType audioOutputType;
private VideoType mode;
private String video;
private Path audio;

private MrlConfiguration videoMrl;
private MrlConfiguration oggMrl;

private EnhancedExecution extractor;
private boolean youtube;
private String mrl; // for file resource load video mrl

private int map;

private int frameWidth;
private int frameHeight;
private int pixelWidth;
private int pixelHeight;

private String url; // for resourcepack url
private byte[] hash;
private String resourcepackUrl; // for resourcepack url
private byte[] resourcepackHash;

public VideoCommandAttributes() {
this.dither = DitherSetting.FILTER_LITE;
Expand Down Expand Up @@ -89,22 +89,6 @@ public void setPlayer(@NotNull final VideoPlayer player) {
this.player = player;
}

public @Nullable String getVideoMrl() {
return this.video;
}

public void setVideoMrl(@NotNull final String video) {
this.video = video;
}

public boolean isYoutube() {
return this.youtube;
}

public void setYoutube(final boolean youtube) {
this.youtube = youtube;
}

public int getFrameWidth() {
return this.frameWidth;
}
Expand Down Expand Up @@ -165,36 +149,20 @@ public void setMode(@NotNull final VideoType mode) {
this.mode = mode;
}

public @Nullable String getUrl() {
return this.url;
}

public void setUrl(@NotNull final String url) {
this.url = url;
}

public byte @Nullable [] getHash() {
return this.hash;
}

public void setHash(final byte @NotNull [] hash) {
this.hash = hash;
public @Nullable String getResourcepackUrl() {
return this.resourcepackUrl;
}

public @NotNull Path getAudio() {
return this.audio;
public void setResourcepackUrl(@NotNull final String resourcepackUrl) {
this.resourcepackUrl = resourcepackUrl;
}

public void setAudio(@NotNull final Path audio) {
this.audio = audio;
public byte @Nullable [] getResourcepackHash() {
return this.resourcepackHash;
}

public @NotNull String getMrl() {
return this.mrl;
}

public void setMrl(@NotNull final String mrl) {
this.mrl = mrl;
public void setResourcepackHash(final byte @NotNull [] resourcepackHash) {
this.resourcepackHash = resourcepackHash;
}

public EnhancedExecution getExtractor() {
Expand All @@ -212,4 +180,20 @@ public AudioOutputType getAudioOutputType() {
public void setAudioOutputType(@NotNull final AudioOutputType audioOutputType) {
this.audioOutputType = audioOutputType;
}

public MrlConfiguration getVideoMrl() {
return this.videoMrl;
}

public void setVideoMrl(final MrlConfiguration videoMrl) {
this.videoMrl = videoMrl;
}

public MrlConfiguration getOggMrl() {
return this.oggMrl;
}

public void setOggMrl(final MrlConfiguration oggMrl) {
this.oggMrl = oggMrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public VideoCreator(
}

public @NotNull VideoPlayer createBlockHighlightPlayer(
@NotNull final Player sender, @NotNull final Collection<? extends Player> viewers) {
@NotNull final Player sender) {
return VideoBuilder.unspecified()
.callback(
CallbackBuilder.blockHighlight()
Expand Down
Loading