我有以下尝试在AVPlayer上播放playerItem
$('#editPost').click(function() { //Button used to edit posts
$('#editablePost').val($('#post').html()); //Textarea gets the post html
$('#editablePost').show(); //The textarea is hidden until needed
$('#post').hide(); //Hides original post
$('#editablePost').focus(); //Focuses on the textarea
});
$('#savePost').click(function() { //Button used to save posts
$('#post').html($('#editablePost').val()); //Post gets the value of textarea
$('#editablePost').hide(); //Hides the textarea
$('#post').show(); //Shows post with new text in it
// Code below is what I use to send the information to the database and update
$detail = $('#post').text();
$edit = $('#editPostTime').text();
$id = $('#questionId').text();
$.ajax({
url: 'editPost.php',
type: 'post',
data: {detail: $detail, edit: $edit, id: $id},
datatype: 'html',
success: function() {
<?php
date_default_timezone_set('Europe/London');
$datetime = date("d/m/y H:i"); // create date and time
?>
$('#editPostTime').text('Edited: <?php echo $datetime; ?>'); //Updates on page when post was edited
}});
});
从控制台,即使视频可以正确播放,我也总是会出现以下错误
let avAsset = AVAsset(url: url)
let playerItem = AVPlayerItem(asset: avAsset)
let avPlayer = AVPlayer()
let playerLayer = AVPlayerLayer(player: avPlayer)
playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
avPlayer.replaceCurrentItem(with: playerItem)
avPlayer.seek(to: kCMTimeZero)
avPlayer.play()
我不确定是否因为使用网址从AWS S3加载了AVAsset,所以我们非常感谢