Tôi biết bây giờ bạn hy vọng đã giải quyết được vấn đề của mình. Nhưng chỉ trong trường hợp. Nếu bạn muốn có một giải pháp chuyển tiếp thẳng, bạn luôn có thể nhận được mã nhúng hoặc bất kỳ liên kết nào khác và tạo một tệp html ra khỏi nó. Giống như
<html>
<body>
<script type="text/javascript">
var embedBaseUrl = 'http://www.tv.net/';
var embedChannelId = 13;
var embedSize = [300,250];
var embedAutoplay = true;
</script>
<script type="text/javascript"src="http://www.tv.net/assets/js/embed.js"></script>
</body>
</HTML>
ViewController.h
@interface ViewController : UIViewController {
NSString *videoURL;
}
@property (nonatomic, strong) NSString *videoURL;
(IBAction) tv;
Và trong ViewController.m
@synthesize videoURL;
(IBAction) tv {
self.videoURL = @"http://dl.dropbox.com/x/xxxxxxxx/HTML/tv.html";
VideoViewController *videoViewController = [[VideoViewController alloc] initWithNibName:nil bundle:nil];
videoViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; videoViewController.videoURL = self.videoURL;
[self presentViewController:videoViewController animated:YES completion:nil]; }
Và sau đó trong VideoViewController.h
IBOutlet UIWebView *videoView;
NSString *videoURL; NSString *videoHTML;
}
@property(nonatomic, retain) IBOutlet UIWebView *videoView; @property(nonatomic, retain) NSString *videoURL; @property(nonatomic, retain) NSString *videoHTML;
(void) embedTV;
VideoViewController.m
@synthesize videoView, videoURL, videoHTML;
(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; }
(void)embedTV {
videoHTML = [NSString stringWithFormat:@"\ \ \ \ iframe {position:absolute; top:50%%; margin-top:-130px;}\ body {background-color:#000; margin:0;}\ \ \ \ \ \ ", videoURL];
[videoView loadHTMLString:videoHTML baseURL:nil]; }
(void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib.
videoView.backgroundColor = [UIColor blackColor]; videoView.opaque = NO;
[self embedTV]; }
Bây giờ trong ví dụ của tôi, tôi gọi cho luồng video nhưng bạn có được điểm, bạn có thể truyền hoặc chơi những gì bạn muốn. Chỉ cần sử dụng UIWebView
.
Nguồn
2012-11-08 15:52:31
Matt, tôi là người hâm mộ lớn của trang web của bạn. Bạn là một trong số ít các nguồn cấp dữ liệu được chọn có mức độ ưu tiên cao về việc đảm bảo tôi luôn hoạt động trên các lần đọc. Cảm ơn bạn rất nhiều vì đã cống hiến lại với cái nhìn sâu sắc của bạn. – Coocoo4Cocoa
Hey @MattGallagher, [bạn có nghĩ rằng có thể truyền âm thanh theo cách khác] (http://stackoverflow.com/questions/6166019/stream-audio-from-ios)? (Từ thiết bị iOS sang máy khác?) – Moshe
@ Chạy Chạy máy chủ phương tiện truyền trực tuyến cũng khó như các tính năng bạn cần (có thể rất khó). Cung cấp một tệp MP3 đơn giản qua HTTP rất đơn giản và có thể xử lý hầu hết các tình huống thông thường. Phục vụ luồng trực tiếp vì nó đang được ghi lại rất khó. –