HTML5ビデオプレーヤーのフォールバックメカニズムの実装に取り組んでいます。swfobject Flash Playerに置き換える方法はありますが、問題が発生したかどうかをどのように検出する必要がありますか?
つまり、スローされる可能性のある次のエラーイベントのリストを使用する場合、Flashプレーヤーの交換をトリガーする必要があるのはどれですか?または、エラーがスローされた場合は、単に交換を行う必要がありますか?
また、onErrorハンドラーはどこで呼び出す必要がありますか?ビデオタグを考えていますが、確認したいと思います。あなたの指導は大歓迎です。ありがとう。
function failed(e) {
// video playback failed - show a message saying why
switch (e.target.error.code) {
case e.target.error.MEDIA_ERR_ABORTED:
alert('You aborted the video playback.');
break;
case e.target.error.MEDIA_ERR_NETWORK:
alert('A network error caused the video download to fail part-way.');
break;
case e.target.error.MEDIA_ERR_DECODE:
alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
break;
case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
break;
default:
alert('An unknown error occurred.');
break;
}
}