Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
6_组件-多媒体
Search
powerhope
August 11, 2016
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
6_组件-多媒体
App Inventor移动应用开发
powerhope
August 11, 2016
More Decks by powerhope
See All by powerhope
1_App Inventor初步
powerhope
0
290
2_1_HelloPurr
powerhope
0
150
2_2_8-Ball(魔术8球)
powerhope
2
170
3_App Inventor编程基础
powerhope
0
140
4_组件-用户界面
powerhope
0
190
5_组件-界面布局
powerhope
0
180
7_组件-绘图动画
powerhope
0
160
8_组件-传感器
powerhope
0
160
9_组件-社交应用
powerhope
0
190
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
340
58k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
970
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The Curious Case for Waylosing
cassininazir
1
490
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
810
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
660
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Transcript
College of Mathematics and Computer Science, Hunan Normal University 瞿绍军
湖南师范大学数学与计算机科学学院
College of Mathematics and Computer Science, Hunan Normal University 多媒体
College of Mathematics and Computer Science, Hunan Normal University
可以播放声音文件,并使手机产生数毫秒的震动(在 逻辑设计中设定)。 所支持的声音文件格式请参见Android设备支持的 媒体格式。主要包括3GPP(.3gp)、MPEG-4(.mp4 ,.m4a)、mp3等 音效Sound
College of Mathematics and Computer Science, Hunan Normal University
最小间隔:两次播放声音之间的最小时间间隔,如 果正在播放声音,在最小时间间隔内,另外对播放 ()方法的调用都将被忽略。 源:指定播放的声音文件。 音效Sound
College of Mathematics and Computer Science, Hunan Normal University 音效Sound
College of Mathematics and Computer Science, Hunan Normal University
可以播放音频,并控制手机的震动。在组件设计及 逻辑设计中,用源属性来定义音频来源,震动的时 间长度(毫秒数)需要在逻辑设计中设定。 该组件适合于播放长的音频文件,如歌曲,而音效 组件更适合于播放短的文件,如音效。 音频播放器Player
College of Mathematics and Computer Science, Hunan Normal University
只能在前台运行( PlayOnlyInForeground) :如果选中,当离开当前屏 幕时,播放将暂停;如果不 选中(默认),则无论当前屏 幕是否显示,声音都将继续 播放。 音频播放器Player
College of Mathematics and Computer Science, Hunan Normal University 音频播放器Player
College of Mathematics and Computer Science, Hunan Normal University
播放状态(IsPlaying): 当音频正在播放时的值 为true,其它情况(未播放、暂停、停止等)均为 false。 音频播放器Player
College of Mathematics and Computer Science, Hunan Normal University
制作图示音频播放器。包括播放、暂停、停止、上 一首、下一首五个功能。 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University 组件
所属组件组 命名 用途 属性 Screen Screen1 水平对齐:居中 AppName: playerSounds 标题:音频播放器 水平布局 界面布局 水平布局1 水平放置组件 水平对齐:居中 宽度:充满 按钮 用户界面 按钮_播放 播放声音 文本:播放 按钮 用户界面 按钮_暂停 暂停播放声音 文本:暂停 按钮 用户界面 按钮_停止 停止播放声音 文本:停止 按钮 用户界面 按钮_上一首 播放上一首声 音 文本:上一首 按钮 用户界面 按钮_下一首 播放下一首声 音 文本:下一首 音频播放 器 多媒体 音频播放器1 实现音频播放 器的各种功能 源文件:1.mid 对话框 用户界面 对话框1 提醒已经是最 前或最后一首 音频 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University 音频播放器实例
College of Mathematics and Computer Science, Hunan Normal University
录音机是录制音频的多媒体组件。当声音录制完成 后,会自动保存声音文件到特定的目录。 它只有一个SavedRecording属性,可以填入字符 串用来指定录制的声音完整路径和文件名。如果没 有指定此属性,录音机会自己创建一个文件名(如 “app_inventor_*.3gp”,*是一串数字),并保存在 “内部存储/My Documents/Recordings”下。如果 需要指定路径和文件名需要按照 “/sdcard/test/a.3gp”,即文件名称为“a.3gp”, 保存路径在内部存储下的“test”文件夹下。 录音机SoundRecorder
College of Mathematics and Computer Science, Hunan Normal University 录音机SoundRecorder
College of Mathematics and Computer Science, Hunan Normal University 录音机
College of Mathematics and Computer Science, Hunan Normal University 录音机
College of Mathematics and Computer Science, Hunan Normal University 录音机
College of Mathematics and Computer Science, Hunan Normal University
增加指定保存路径和增加用户输入保存的文件名功 能 录音机
College of Mathematics and Computer Science, Hunan Normal University
在调用开始录音之间,先设定了录音机的 “SavedRecording”属性,需要注意的是内部存 储下一定要存在test文件夹,否则会报错误。 录音机
College of Mathematics and Computer Science, Hunan Normal University
该组件用于播放视频,在应用中显示为一个矩形方 框,用户触摸矩形时,将出现控制箭头:播放/暂 停、快进、快退。 视频文件必须为.3gp或.mp4格式,关于媒体格式 的详细内,参见Android设备支持的媒体文件格式 。 视频播放器VideoPlayer
College of Mathematics and Computer Science, Hunan Normal University
你也可以将播放组件的源属性设置为URL地址,来 播放网络上的视频资源,但URL必须指向视频文件 本身,而不是视频播放程序。 视频播放器VideoPlayer
College of Mathematics and Computer Science, Hunan Normal University 视频播放器
College of Mathematics and Computer Science, Hunan Normal University 视频播放器
College of Mathematics and Computer Science, Hunan Normal University 视频播放器
College of Mathematics and Computer Science, Hunan Normal University 视频播放器
College of Mathematics and Computer Science, Hunan Normal University
摄像机是非可视组件,它可以利用设备的摄像机录 制视频。录制完成后,将触发录制完成事件,记录的 视频剪辑保存在设备上,其文件名将成为事件的参 数(默认位置为 content://media/external/video/media/)。 文件名可以被设定为某个视频播放组件的源文件属 性。 摄像机Camcorder
College of Mathematics and Computer Science, Hunan Normal University 摄像机
College of Mathematics and Computer Science, Hunan Normal University 摄像机
College of Mathematics and Computer Science, Hunan Normal University 摄像机
College of Mathematics and Computer Science, Hunan Normal University
照相机是非可视组件,它可以使用设备上的照相机 进行拍照。拍照结束后将触发拍照完成事件,照片 将保存在手机中,包含照片文件的路径将有效。该 路径可以作为某个图像组件的图片属性。 照相机Camera
College of Mathematics and Computer Science, Hunan Normal University
允许使用前置摄像头(UseFront):设定是否使用 前置相机(如果可用的话)。如果设备没有前置相机 ,将跳过此选项而打开常规相机。 照相机Camera
College of Mathematics and Computer Science, Hunan Normal University 照相机
College of Mathematics and Computer Science, Hunan Normal University 照相机
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
图像选择框是一个专用按钮,当用户点击它时,将 打开设备上的图库,用户可以选择一张图片。当选 择一张图片后,图片被保存,组件的选中属性被设 定为图像的文件名(也是图像本身)。为了节省存储 空间,最多存放10张图片,如果超过10张,将按 顺序删除最早选取的图片。 图像选择框的属性基本上与普通按钮一致。 图像选择框ImagePicker
College of Mathematics and Computer Science, Hunan Normal University 图像选择框
College of Mathematics and Computer Science, Hunan Normal University 图像选择框
College of Mathematics and Computer Science, Hunan Normal University 图像选择框
College of Mathematics and Computer Science, Hunan Normal University 图像选择框
College of Mathematics and Computer Science, Hunan Normal University 图像选择框
College of Mathematics and Computer Science, Hunan Normal University
文本语音转换器组件是将文本转换成语音,为了使 该组件正常运行,手机上需要安装有相应的文本识 别成语音的引擎,如TTS,一般情况下Android手 机默认都安装有。 文本语音转换器TextToSpeech
College of Mathematics and Computer Science, Hunan Normal University 文本语音转换器
College of Mathematics and Computer Science, Hunan Normal University
国家(Country):可以从下来列表中选择文本语 音转换器支持的国家代码。国家代码采用三个大写 字母,如美国用USA表示。 语言(Language):文本语音转换器支持的语言 代码。语言代码采用两个小写字母表示,如de表示 德语,en表示英语, es表示捷克语,fr表示法语, it表示意大利语。 文本语音转换器
College of Mathematics and Computer Science, Hunan Normal University
音调(Pitch):设置合成语音的音调,范围为0至 2之间,数值越小音调越低,数值越高,音调也越 高。 语速(SpeechRate):设置合成语音的语速,范 围为0至2之间,数值越低语速越慢,数值越高,语 速越高。 Result(结果):只能在逻辑设计中调用,念读文 本结束后的返回值,真或者假。 文本语音转换器
College of Mathematics and Computer Science, Hunan Normal University 文本语音转换器
College of Mathematics and Computer Science, Hunan Normal University 文本语音转换器
College of Mathematics and Computer Science, Hunan Normal University
使用Android设备的语音识别功能,将语音转化为 文字。 语音识别SpeechRecognizer
College of Mathematics and Computer Science, Hunan Normal University 语音识别SpeechRecognizer
College of Mathematics and Computer Science, Hunan Normal University
Yandex是俄罗斯重要网络服务门户之一,Yandex 语言翻译器是Yandex公司的产品,它可以实现在 不同语言之间翻译单词和句子。该组件需要访问网 络和请求Yandex.Translate服务。可以在逻辑设计 中指定目标语言,如果只提供了目标语言,源语言 自动根据需要翻译的内容进行检测。也可以通过“源 语言-目标语言”指定源语言到目标语言,如“en- zh”指英语翻译成中文。语言代码采用两个小写字 母,支持的语言可以查看网站( https://tech.yandex.com/translate/doc/dg/c oncepts/langs-docpage/)。 Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University
获得译文(GotTranslation):调用请求翻译方法 后,翻译服务返回翻译文本后,该事件为错误处理 提供了一个响应代码,如果响应代码是200,则返 回了正确结果。其它响应代码表示调用发生了某个 错误和翻译是无效的。 Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University
请求翻译(RequestTranslation):需要提供一个 目标语言和一个单词或句子给翻译器,此方法将向 Yandex.Translate 服务请求翻译。一旦文本通过 外部服务翻译,获得译文方法将被执行。如果只提 供了目标语言,源语言自动根据需要翻译的内容进 行检测。也可以通过“源语言-目标语言”指定源语言 到目标语言,如“en-zh”指英语翻译成中文。 Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University Yandex语言翻译器
College of Mathematics and Computer Science, Hunan Normal University
实验3:制作App贺卡,要求使用到图像、声音和 多个屏幕等。 实验4:制作一个视频播放器。 实验