Skip to content

Commit 29168e9

Browse files
author
v_shanxia
committed
fix:音频示例更改
1 parent 02a8b5b commit 29168e9

File tree

4 files changed

+449
-4
lines changed

4 files changed

+449
-4
lines changed

Demo/API_V2/Assets/API/Media/InnerAudio/InnerAudio.cs

+40-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66

77
public class InnerAudio : Details
88
{
9+
WXInnerAudioContext music;
10+
private void Start()
11+
{
12+
// 绑定额外的按钮操作
13+
GameManager.Instance.detailsController.BindExtraButtonAction(0, pause);
14+
GameManager.Instance.detailsController.BindExtraButtonAction(1, stop);
15+
GameManager.Instance.detailsController.BindExtraButtonAction(2, seek);
16+
}
17+
918
protected override void TestAPI(string[] args)
1019
{
11-
var music = WX.CreateInnerAudioContext(new InnerAudioContextParam() {
20+
music = WX.CreateInnerAudioContext(new InnerAudioContextParam() {
1221
src = "https://res.wx.qq.com/wechatgame/product/webpack/userupload/20220901/211827/CallMeTeenTop.mp3",
1322
needDownload = true //表示等下载完之后再播放,便于后续复用,无延迟
1423
});
@@ -19,4 +28,34 @@ protected override void TestAPI(string[] args)
1928
});
2029
}
2130

31+
32+
//暂停
33+
public void pause()
34+
{
35+
Debug.Log("pause");
36+
music.Pause();
37+
}
38+
39+
//停止
40+
public void stop()
41+
{
42+
Debug.Log("stop");
43+
music.Stop();
44+
45+
}
46+
47+
//跳转
48+
public void seek()
49+
{
50+
51+
Debug.Log("seek");
52+
music.Seek(3);
53+
}
54+
55+
private void OnDestroy()
56+
{
57+
Debug.Log("音频示例 OnDestroy");
58+
music.Stop();
59+
music.Destroy();
60+
}
2261
}

Demo/API_V2/Assets/API/Media/InnerAudio/InnerAudioSO.asset

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ MonoBehaviour:
1818
entryDescription:
1919
optionList: []
2020
initialButtonText: "\u64AD\u653E\u97F3\u9891"
21-
extraButtonList: []
21+
extraButtonList:
22+
- buttonText: "\u6682\u505C"
23+
- buttonText: "\u505C\u6B62"
24+
- buttonText: "\u8DF3\u8F6C"
2225
initialResultList: []
2326
entryOrder: 0

Demo/API_V2/Assets/API/Media/MediaSO.asset

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ MonoBehaviour:
1616
categorySprite: {fileID: 21300000, guid: 10009e080ceca4d88b96fcdff0749dfc, type: 3}
1717
entryList:
1818
- {fileID: 11400000, guid: 1d998af43281d4eee9e1effc8f83bddd, type: 2}
19+
- {fileID: 11400000, guid: fc3a7d7719412264b914d0ae6e094405, type: 2}
1920
- {fileID: 11400000, guid: 1055cfc5cdda7407298fa2ff9997d0c6, type: 2}
2021
- {fileID: 11400000, guid: 480646e3cd4d6a948a7538d483c1b043, type: 2}
2122
- {fileID: 11400000, guid: ad04526c3748b4e2b8498f998dfea973, type: 2}

0 commit comments

Comments
 (0)