我正在使用:
#import "ViewController.h"
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)playAudio:(id)sender {
NSURL *url = [NSURL URLWithString:@"https://path/to/my.mp3"];
[self performSegueWithIdentifier:@"playSegue" sender:url];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
AVPlayerViewController *viewController = (AVPlayerViewController *)segue.destinationViewController;
viewController.player = [AVPlayer playerWithURL:(NSURL *)sender];
}
@end
适用于Chrome,Firefox,IE 10+,但不适用于Safari。 我试着用:
<input type="file" accept=".csv" />
它只是在Safari上工作。 帮助我跨浏览器。 感谢。
答案 0 :(得分:7)
只需使用逗号即可)
<input type="file" accept=".csv, text/csv" />