新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Error handling in'Javascript Preview SDK'

新規投稿

コメント

2件のコメント

  • Murtza

     I agree this would be a valuable feature to have. I asked the team who created this SDK. Unfortunately, there is currently nothing implemented in the SDK to help you catch the token expiration event.

    0
    コメントアクション Permalink
  • techiebala

    Thanks for your response.

     

    Currently I've taken advantage of load event to handle this situation. Like, 

     

    Box.Preview.on("load",function(resp){
        if( typeof resp.error !== 'undefined' )
    Box.Preview.updateToken(); });

     

    response:  

    {
    "error":"We're sorry, the preview didn't load. Please refresh the page.", "metrics":{
    "locale":"en-US", "event":"preview", "browser":{ "name":"Chrome","swf":true,"svg":true,"mse":true,"webgl":true,"mp3":true,"dash":true,"box3d":true, "h264":{"baseline":true,"main":true,"high":true} }, "converted":true,"cache":{"hit":false,"stale":false}, "time":{"conversion":0,"rendering":398,"total":398}, "count":{"success":0,"error":1,"navigation":0}}, "file":{"id":""}
    }

     Here, When I call update token method,

    Box.Preview.updateToken();

     Its doing two tasks

        1. Updates the token - Worked.

        2. Retries to load the current file which was failed. - Not Working, Still failing to load,

    Issue might be, cached requests of current file.  Because, viewing any other file in the collection loads fine. after that if I try to view the failed file that also works.

     

    Please help me to resolve this issue.

    0
    コメントアクション Permalink

サインインしてコメントを残してください。