我试着让jwplayer在android手机上工作,当我把rtsp协议文件源它在android工作正常,但显示错误,该文件无法在iOS和PC上播放
没有rtsp文件源工作在PC和iOS上rtsp文件源只能在android中工作
jwplayer("mediaplayer").setup({
playlist: [{
sources: [
{file:'rtmp://localhost:1935/vod/mp4:dexter.mp4'}//used it to PC ,
{file:'rtsp://localhost:1935/dexter/dexter.mp4'}// used it to android,
{file:'http://localhost:1935/vod/mp4:dexter.mp4/playlist.m3u8'}//and this for iOS
],
title: 'dexter',
width: 854,
height: 480,
});
Run Code Online (Sandbox Code Playgroud)
我已经通过检查设备是否是 android 解决了这个问题
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
jwplayer("mediaplayer").setup({
playlist: [{
sources: [
(isAndroid)?{file:'rtsp://localhost:1935/vod/dexter/dexter.mp4'}:{file:'rtmp://localhost:1935/vod/mp4:dexter/dexter.mp4'},
{file:'http://localhost:1935/vod/mp4:dexter.mp4/playlist.m3u8'}
],
title: 'dexter',
width: 854,
height: 480,
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5887 次 |
| 最近记录: |