好吧,我的Android应用被拒绝了,原因是:
它因为它违反了我们的设备和网络滥用政策以及开发者分发协议的第4.4节。如果您提交了更新,那么之前版本的应用仍会在Google Play上发布。
- 修改您的应用以确保其不会以违反其服务条款的方式访问或使用服务或API;例如,启用YouTube视频的背景播放。
醇>
我按照本教程创建和显示我的YouTube Feed:
https://github.com/hughred22/YouTube-Video-Listing-Ionic-Mobile-App/wiki/Step-by-Step-Tutorial
.controller('videoCtrl', function($scope, $http){
$scope.videos = [];
//YouTube API settings for main video page
$scope.youtubeParams = {
key: 'AIzaSyDquqHEMvVJ1qmI3_17cTs_jdakjshdka',
type: 'video',
maxResults: '5',
part: 'id,snippet',
//q: 'creatorup',
order: 'date',
channelId: 'UCll2vOerYsQ02RwzD2Uwjhhj',
}
$scope.playerVars = {
rel: 0,
showinfo: 0,
modestbranding: 0,
}
$scope.$on('youtube.player.ready', function ($event, player) {
$rootScope.YTPlayer = player;
});
//document.addEventListener("pause", function() {
//if ($rootScope.YTPlayer) {
//$rootScope.YTPlayer.stopVideo();
//$rootScope.YTPlayer.pauseVideo();
//}
//}, false);
//$scope.$on('youtube.player.paused', function ($event, player) {
//if ($rootScope.YTPlayer) {
//player.pauseVideo();
//$rootScope.YTPlayer.pauseVideo();
//}
//});
$scope.$on('$ionicView.beforeLeave', function(){
if ($rootScope.YTPlayer) {
//$rootScope.YTPlayer.stopVideo();
$rootScope.YTPlayer.pauseVideo();
}
});
$http.get('https://www.googleapis.com/youtube/v3/search', {params:$scope.youtubeParams}).success(function(response){
angular.forEach(response.items, function(child){
//console.log (child);
$scope.videos.push(child);
});
});
})
正如您在此处所看到的,我正在使用的变体来收听网页视图:
document.addEventListener("pause", function() {
if ($rootScope.YTPlayer) {
$rootScope.YTPlayer.pauseVideo();
}
}, false);
$scope.$on('youtube.player.paused', function ($event, player) {
if ($rootScope.YTPlayer) {
$rootScope.YTPlayer.pauseVideo();
}
});
$scope.$on('$ionicView.beforeLeave', function(){
if ($rootScope.YTPlayer) {
//$rootScope.YTPlayer.stopVideo();
$rootScope.YTPlayer.pauseVideo();
}
});
无论我使用什么,当应用程序在后台时,我都无法暂停视频。我已经看到了几个线程,但没有一个有用。谢谢!