IOS : cannot convert filePath in URL .
Closed this issue · 4 comments
When using a subtitle link in the vidoPlay
function, I encounter the following error: {"method":"initPlayer","message":"cannot convert filePath in URL","result":false}
. I have checked that all the necessary data exists.
Here's a short brief about the issue that you can post on GitHub:
Issue: Error when using subtitle link in vidoPlay
function
Description:
I am facing an error when attempting to use a subtitle link in the vidoPlay
function. The error message is as follows: {"method":"initPlayer","message":"cannot convert filePath in URL","result":false}
. I have ensured that all the required data is present.
Code:
vidoPlay(url, sub, title) {
let urls = url;
let subtitleUrl = Capacitor.convertFileSrc(this.movie.subtitle_url1);
console.log(subtitleUrl);
if (urls && subtitleUrl) {
CapacitorVideoPlayer.initPlayer({
url: urls,
playerId: "vpPlayer",
mode: "fullscreen",
title: title,
subtitle: String(subtitleUrl),
subtitleOptions: {
fontSize: 16
},
pipEnabled: true,
showControls: true,
displayMode: "landscape"
}).then((a) => {
console.log(a);
CapacitorVideoPlayer.play({
playerId: 'vpPlayer',
}).then((a) => {
// Handle play success
});
}).catch(e => {
alert(e);
});
}
}
Expected Behavior:
I expect the CapacitorVideoPlayer.initPlayer
function to accept the subtitle link provided in the subtitleUrl
variable and display the subtitles accordingly. However, the error mentioned above is encountered.
Steps to Reproduce:
- Call the
vidoPlay
function with a validurl
,sub
, andtitle
. - Ensure that the
subtitleUrl
variable contains a valid subtitle link. - Observe the error message
{"method":"initPlayer","message":"cannot convert filePath in URL","result":false}
.
Additional Information:
- I have verified that all the necessary data (URLs, titles, etc.) is present and correct.
- I have tested the
CapacitorVideoPlayer
library with other functionalities, and they work as expected. - I have tried using the
Capacitor.convertFileSrc
function to convert the subtitle URL, but the error persists.
Any assistance or guidance on resolving this issue would be greatly appreciated. Thank you.
@bravao911 can you give the video url and vidéo subtitle url. Is it from internal urls?. Capacitor.convertFileSrc will not work
@bravao911 can you give the video url and vidéo subtitle url. Is it from internal urls?. Capacitor.convertFileSrc will not work
subtitle url : https://shamia.net/upload/sub/[SubtitleTools.com]%20The.Deep.House.2021.720p1080p.WEBRip.x264.AAC-[YTS.MX]-Arabic.vtt
video url : https://690b1613de1830d27ee50d6b199335dd.silentsong.xyz/Movies/TheDeepHouse.mp4
l have tried
vidoPlay(url,sub,title){
let urls = url
let subtitleUrl = sub
console.log(subtitleUrl)
if (urls&&subtitleUrl) {
CapacitorVideoPlayer.initPlayer({
url:urls,
playerId:"vpPlayer",
mode:"fullscreen",
title:title,
subtitle:subtitleUrl,
subtitleOptions:{
fontSize:16
},
pipEnabled:true,
showControls:true,
displayMode:"landscape"
}).then((a)=>{
console.log(a)
CapacitorVideoPlayer.play({
playerId:'vpPlayer',
}).then((a=>{
}))
}).catch(e=>{
alert(e)
})
}
}
But l have same issue .
If l put subtitle url directly . :
vidoPlay(url,sub,title){
let urls = url
let subtitleUrl = sub
console.log(subtitleUrl)
if (urls&&subtitleUrl) {
CapacitorVideoPlayer.initPlayer({
url:urls,
playerId:"vpPlayer",
mode:"fullscreen",
title:title,
subtitle:"https://shamia.net/upload/sub/[SubtitleTools.com]%20The.Deep.House.2021.720p1080p.WEBRip.x264.AAC-[YTS.MX]-Arabic.vtt",
subtitleOptions:{
fontSize:16
},
pipEnabled:true,
showControls:true,
displayMode:"landscape"
}).then((a)=>{
console.log(a)
CapacitorVideoPlayer.play({
playerId:'vpPlayer',
}).then((a=>{
}))
}).catch(e=>{
alert(e)
})
}
}
he works fine .
l have fixed the issue by adding the language of the subtitle. Ex, my subtitle is Arabic language so l have added language:"0x0001",
As mentioned in doc
@bravao911 so i close the issue