Skip to content

Commit

Permalink
feat: 增加播放控制
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Jan 27, 2023
1 parent 17e6c1f commit 50da52e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bili-bot",
"private": true,
"version": "1.2.2",
"version": "1.2.4",
"type": "module",
"scripts": {
"dev": "npm run build:icon & vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bili-bot"
version = "1.2.3"
version = "1.2.4"
description = "哔哩哔哩-直播间管家机器人"
authors = ["半糖人类"]
license = "MIT"
Expand Down
15 changes: 15 additions & 0 deletions src/views/Robot/video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let curStreamIndex = 0;
const volume = ref(0.5);
const audioMode = ref(false);
const isPlaying = ref(false)
const changeVolume = (event: WheelEvent) => {
const { deltaY } = event;
Expand Down Expand Up @@ -82,6 +83,7 @@ const initPlayer = () => {
videoRef.value.style.maxHeight = '393px';
videoRef.value.style.width = '100%';
}
isPlaying.value = true
});
} else {
message('系统不支持flv.js')
Expand Down Expand Up @@ -120,6 +122,16 @@ watchEffect(async () => {
// curStream.value = props.streams.find(item => item.type === 'm3u8');
})
const switchPlay = () => {
if (isPlaying.value) {
flvPlayer.pause();
flvPlayer.unload();
isPlaying.value = false
} else {
flvPlayer.load();
}
}
</script>

Expand All @@ -129,6 +141,9 @@ watchEffect(async () => {
<div class="flex justify-around items-center gap-4">
<div :class="audioMode ? 'i-carbon-video-filled' : 'i-carbon-headphones'"
class="text-5xl text-white hover:cursor-pointer" @click="switchAudioMode" />
<div :class="isPlaying ? 'i-carbon-stop-outline' : 'i-carbon-play-filled'"
class="text-4xl text-white hover:cursor-pointer" @click="switchPlay" />

</div>
</div>
</template>

0 comments on commit 50da52e

Please sign in to comment.