2017-04-07 55 views
0

我第一次嘗試離子2。 雖然我有一個問題。我無法弄清楚我需要鏈接到哪個視頻文件。離子2:鏈接到視頻文件

我使用的一個插件(cordova-vr-player)使用VR視圖。

在某些時候,對home.ts,我把GoogleVRPlayer.playVideo('shark.mp4'); 這將打開播放器,但後來我得到的錯誤(在Android):

Error loading video: com.google.android.exoplayer.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: shark.mp4: open failed: ENOENT (No such file or directory).

我已經把shark.mp4在同一文件夾中home.ts

任何人誰可以幫助我?

回答

0

插件,jleszczynski的製造商,是一種足以help我出去:

var path = cordova.file.applicationDirectory + 'www/video.mp4'; GoogleVRPlayer.playVideo(path);

要求:cordova-plugin-file

0

編輯:看來我錯了!正確答案here


當編譯應用程序會從WWW文件夾的根目錄讀取。

我會建議在設置文件夾結構和移動視頻一樣 - 在你的代碼WWW /資產/視頻/ shark.mp4

然後,你可以參考視頻,像這樣:

GoogleVRPlayer。的playVideo(資產/視頻/ shark.mp4')

+0

感謝您的建議。不幸的是,它沒有奏效。玩家一直說文件不在那裏。 – binoculars