Navigation Menu

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

[html] 第47天 HTML5如何使用音频和视频? #177

Open
haizhilin2013 opened this issue Jun 1, 2019 · 4 comments
Open

[html] 第47天 HTML5如何使用音频和视频? #177

haizhilin2013 opened this issue Jun 1, 2019 · 4 comments
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第47天 HTML5如何使用音频和视频?

@haizhilin2013 haizhilin2013 added the html html label Jun 1, 2019
@rocky-191
Copy link

video和audio标签

@xiangshuo1992
Copy link
Contributor

HTML5 新标签可以直接用video和audio,但是想要自动播放还有些兼容性问题,在手机上各浏览器需要做兼容处理。

@blueRoach
Copy link

video audio

@coderRedw
Copy link

视频

音频和视频一样

音频
1。事件
1-1 canplay 事件
+ 会在音频加载完毕可以播放以后执行
1-2 timeupdate 事件
+ 会在音频播放以后,时间改变的时候触发
1-3 ended 事件
+ 会在视频播放完毕后触发

2。属性
  2-1 paused 
    + 是否暂停
  2-2 currentTime
    + 当前播放时间
    + 读写的属性,可以获取当前播放时间(单位是秒)
  2-3 volume
    + 获取当前播放的音量
    + 读写的属性,0 ~ 1 之间
  2-4 muted
    + 获取当前音量是否静音
    + 读写的属性
  2-5 duration
    + 获取当前视音频的总播放时间
    + 只读属性(秒)
3。方法
  3-1 play()
    + 调用的时候会让音乐播放
  3-2 pause()   
    + 调用的时候会让音乐暂停
  3-3 stop() (现在不支持了)
    + 调用的时候会让音乐回到最初状态

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

5 participants