[英]How to hide error code in the error message in JWPlayer?
我有一個 React 代碼,如下所示,它呈現播放器。 在下面的代碼中,我使用 ReactJWPlayer 組件及其道具。 為了配置intl.{lang}.errors ,我使用了react-jw-player公開的 customProps 選項
const ReactJWPlayerContainer = props => {
const [error, setError] = useState("");
const [errorNode, setErrorNode] = useState(null);
const player = ()=> {
return (
<ReactJWPlayer
playlist={[props.playlist]}
customProps={{
intl: {
en: {
errors: {
badConnection: "This video cannot be played because of a problem with your internet connection.",
cantLoadPlayer: "Sorry, the video player failed to load.",
},
},
fr: {
errors: {
badConnection: "This video cannot be played because of a problem with your internet connection.",
cantLoadPlayer: "Sorry, the video player failed to load.",
},
},
},
}}
/>
)
}
}
return (
<>
{props.playlist && player()}
</>
)
}
如果播放器加載失敗,上面的代碼會成功顯示帶有相應錯誤代碼的自定義錯誤消息。
問題陳述:
我想知道我需要對上面的 React 代碼進行哪些更改才能成功隱藏錯誤代碼。 在下面的屏幕截圖中,我想隱藏該行(Error Code: 232011)
您必須將 props.playlist 作為變量傳遞,但您將作為數組項傳遞。
將此代碼 playlist={[props.playlist]} 更改為 playlist={props.playlist}
我假設 props.playlist 是一個像這個例子一樣的數組:
https://github.com/micnews/react-jw-player#playing-a-custom-playlist
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.