javascript - Is it possible to select a quality for the azure media player using its javascript API?
问题描述
Looking to implement azure media player for a project. But we need to use our existing custom video controls. Is it possible to control the quality selector by javascript? Have not been able to find anything concerning this in the documentation..
Does anyone have experience with this?
Any help would be appreciated!
Could also be worth noting that this is a react.js project.
Thanks,
解决方案
您可以指定启发式配置文件(HighQuality、Hybrid、LowLatency、QuickStart):
http://amp.azure.net/libs/amp/latest/docs/index.html#amp.player.heuristicprofile
http://amp.azure.net/libs/amp/latest/docs/#amp.videostream.selecttrackbyindex
尝试这样的事情:
myPlayer.addEventListener(amp.eventName.loadedmetadata,
function() {
var stream = myPlayer.currentVideoStreamList().streams ?
myPlayer.currentVideoStreamList().streams[0] :
undefined;
if (stream) {
stream.selectTrackByIndex(0);
}
});
myPlayer.src([{
src: "[srcuri]",
type: "application/vnd.ms-sstr+xml"
}]);
推荐阅读
- linux - 如何在 Ubuntu 上授予英特尔实感摄像头的权限
- javascript - 在 React 中导入 prop 数组值?
- r - 如何将变量从整数转换为基数 R 中的字符串?
- java - Ear 文件不包含子模块的依赖关系
- asp.net - 升级到 ASP.NET Zero (Angular) 中的 FontAwesome Pro/显示为正方形的远距离图标
- c++ - 如何在 Mac 上处理 VS Code 中的 C++ 头文件#include 错误?
- ios - 世博会推送通知 iOS APNS
- reactjs - React 放置自动完成多个类型的问题(Nextjs)
- c# - 我想通过单击将按钮移动到堆栈面板的最顶部
- python - 根据时间戳将数据帧拆分为多个子数据帧