小编Jom*_*oos的帖子

设置contentURL时,在iPhone 4.3模拟器中再次调用MPMoviePlayerPlaybackDidFinishNotification

注意:请参阅底部的更新.


我有一个应用程序从列表中逐个播放视频.因此,为了测试此功能,我创建了一个只有一个视图控制器的简单应用程序.在实现视图控制器之前,我引用了此博客.视图控制器已命名TNViewController,其实现如下:

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>

@interface TNViewController : UIViewController {
  @private
    NSMutableArray *_videoArray;
    int _currentVideo;

    MPMoviePlayerController *_moviePlayer;
    NSURL *_movieUrl;
}

@end
Run Code Online (Sandbox Code Playgroud)

它的实施是:

#import "TNViewController.h"

@implementation TNViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
    [self.view setFrame:CGRectMake(0, 0, 480, 320)];

    [self initVideos];
    [self initPlayer];
}

- (void) initVideos {
    _videoArray = [[NSMutableArray alloc] init];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"sintel_trailer" ofType:@"mp4" inDirectory:nil]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios mpmediaplayercontroller

5
推荐指数
1
解决办法
3624
查看次数

Android arp表——开发题

我正在编写的 android 应用程序有两个问题。

我正在读取本地 arp 表/proc/net/arp,并将 ip 和相应的 mac 地址保存在哈希映射中。看我的功能。它工作正常。

    /**
     * Extract and save ip and corresponding MAC address from arp table in HashMap
     */
    public Map<String, String> createArpMap() throws IOException {      
        checkMapARP.clear();
        BufferedReader localBufferdReader = new BufferedReader(new FileReader(new File("/proc/net/arp")));
        String line = "";       

        while ((line = localBufferdReader.readLine()) != null) {            
            String[] ipmac = line.split("[ ]+");
            if (!ipmac[0].matches("IP")) {
                String ip = ipmac[0];
                String mac = ipmac[3];
                if (!checkMapARP.containsKey(ip)) {
                    checkMapARP.put(ip, mac);               
                }                   
            }
        }
        return Collections.unmodifiableMap(checkMapARP); …
Run Code Online (Sandbox Code Playgroud)

java android

5
推荐指数
1
解决办法
7199
查看次数

linux中的部分目录列表

如果我有一个包含数百个文件的目录,使用ls,ls-l或者dir给我一个对于命令终端屏幕来说太长的列表,那么我无法看到目录中的大多数文件.

我记得有一些争论ls允许人们以较短的增量滚动列表,但似乎无法找到它.

linux shell

5
推荐指数
1
解决办法
2766
查看次数

从头开始的PHP MVC - 如何连接这些类?

首先,我知道

  • 不要重新发明轮子
  • MVC有很多框架.

这不是为了制作工作,而是为了我的爱好项目.我从头开始编写MVC是为了更深入地了解MVC,并让我满意.最后,我可以对自己说:" 你做了好友.你自己写了一个MVC框架! "


我现在的问题.通常,我们会在MVC中编写一些类,并且从一开始就存在.我们通常所说的他们,像,Bootstrapper,Router,Registry,和Config.可能会有更多,但我现在想关注这些.通常,每个请求我们不需要这些类的多个实例(单例?).我认为从名称本身可以清楚地知道这些类的作用.所以我现在的问题是:

谁首先开始(我认为是Bootstrapper)?这些类如何链接在一起?他们都需要单身吗?我们如何使这些实例(Bootstrapper可能是一个例外)可用于应用程序中的其他类(也许我们使用单例)?

php model-view-controller

4
推荐指数
1
解决办法
5771
查看次数

ASP.net MVC路由配置

我是MVC的新手,所以我遇到了一些问题,想知道如何为以下场景设置我的路线.

假设我有一个查找航班数据的站点,并显示每个航班的三个主要视图.

我希望URL结构如下:

www.domain.com/<flightnumber>/   <-- Main page for the flight
www.domain.com/<flightnumber>/crew  <-- A page with details of the crew for that flight
www.domain.com/<flightnumber>/destination  <-- details of the destination for the flight
Run Code Online (Sandbox Code Playgroud)

因此,基本上查找键是域之后的第一个项目.URL的任何后续部分都映射到该航班的特定视图.

看似简单,但我似乎无法弄清楚如何构建控制器和路线...

asp.net-mvc

3
推荐指数
1
解决办法
2894
查看次数

Android Mediarecorder:获取3GP而不是MPEG4

我想只用android4格式录制视频.我希望容器和编解码器是MPEG4.所以这就是我为此所做的.

Thread video = new Thread(new Runnable() {
    public void run() {
        videoRecorder = new MediaRecorder();
        videoRecorder.setPreviewDisplay(surfaceView.getHolder().getSurface());
        videoRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        videoRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        videoRecorder.setVideoEncodingBitRate(56 * 8 * 1024);
        videoRecorder.setVideoSize(176, 144);
        videoRecorder.setVideoFrameRate(12);
        videoRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
        videoRecorder.setOutputFile("/sdcard/video.m4e");
        try {
            videoRecorder.prepare();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        videoRecorder.start();
    }
});
video.start();
Run Code Online (Sandbox Code Playgroud)

现在,录制完成后,我将视频录制到video.m4e文件中.但是当我检查它的信息时,我得到了以下信息:

在此输入图像描述

同时我使用以下内容录制音频:

Thread audio = new Thread(new Runnable() {              
    public void run() {
        audioRecorder = new MediaRecorder();
        audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
        audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        audioRecorder.setOutputFile("/sdcard/audio.amr");
        try {
            audioRecorder.prepare();
        } catch (IllegalStateException e) { …
Run Code Online (Sandbox Code Playgroud)

java android audio-recording video-recording

1
推荐指数
1
解决办法
6221
查看次数