I'm currently troubleshooting the use of JWPlayer for streaming videos in an Ionic app. However, I've encountered a problem.
The player only seems to load when I refresh the page, rather than when I navigate through the list of videos.
Here is the code snippet from my controller:
.controller('VideosCtrl', function($scope, $http) { $http.get('http://www.example.com/api/apps-videos').success(function(data, status, headers, config) { $scope.videos = data; $scope.video = data.filter(function(e){ return e.id === $stateParams.videoId; })[0]; jwplayer("jwPlayer").setup({ file: $scope.video.playurl, image: $scope.video.video_image, skin: "bekle" }); }); })
As I am relatively new to this and unsure about passing $scope variables to JavaScript, I have called `jwplayer().setup()` within the controller itself.
While it functions properly upon page refresh, it fails to do so when navigating to another video or accessing it from the list again.
How can I resolve this issue? Additionally, any recommendations on a more efficient approach would be greatly appreciated.
Thank you.