android - 如何在android中实现jwplayer的破折号视频流
问题描述
我有一个 jwplayer 帐户,并在那里上传了一些视频。
现在我想添加质量更改按钮,也想让播放器根据互联网选择视频质量。但是如何做到这一点
xml 文件:-
<com.longtailvideo.jwplayer.JWPlayerView xmlns:jwp="http://schemas.android.com/apk/lib/com.longtailvideo.jwplayer"
android:id="@+id/jwplayer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
java文件:-
mPlayerView = findViewById(R.id.jwplayer);
PlaylistItem playlistItem = new PlaylistItem.Builder()
.file("https://content.jwplatform.com/videos/k6Jle9TB-Ruucf9kn.mp4")
.image("https://image.shutterstock.com/image-photo/mountains-during-sunset-beautiful-natural-260nw-407021107.jpg")
.title("Playlist-Item Title")
.description("Some really great content")
.build();
RelatedConfig related = new RelatedConfig.Builder()
.file("https://content.jwplatform.com/videos/IHToMSjV-Ruucf9kn.mp4")
.autoPlayTimer(5)
.onComplete(RELATED_ON_COMPLETE_AUTOPLAY)
.autoPlayMessage("new video will begin in 10 seconds")
.build();
List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(playlistItem);
PlayerConfig config = new PlayerConfig.Builder()
.playlist(playlist)
.relatedConfig(related)
.build();
mPlayerView.setup(config);
我也想直播视频所以我想出了 DASH,它没有关于 jwplayer 文档的文档。所以从哪里开始请指导我。
解决方案
您不应直接指向 JW 平台上的 MP4 资产。您应该利用他们的交付 API 并拥有一个包含所有相关数据的平台对象 - https://cdn.jwplayer.com/v2/media/k6Jle9TB
此外,让 JW 为您创建 DASH 清单需要企业合同。现在它对你没有什么好处,所以坚持使用他们在我上面链接到的提要中给你的 M3U8 (HLS) 清单。
推荐阅读
- apache-kafka - 如何设置多代理 kafka 集群以避免 kafka 失败?
- postgresql - 使用 AWS DMS 从 DB2 到 PostgreSQL 的数据迁移 - Varchar 字段显示尾随空格
- r - Highcharter R中工具提示和轴的日期格式
- cuda - 带有 cuBLAS 的 cudaMallocManaged(统一内存)
- python-2.7 - 从 TCL shell 调用 python 时在 tcl shell 中执行命令
- flutter - 如何在 Flutter 的 BuildContext.select() 上监听类的变化?
- python - Python 排名不跳数(密集排名)
- multithreading - 在 Intel x86 CPU 中,哪些命令被视为原子操作?
- postgresql - PostgreSQL - 根据写在列上的条件(<,>,=)比较值?
- javascript - 使用 jQuery 堆叠卡片 - 排序动画?