Code Monkey home page Code Monkey logo

Comments (5)

kevingpqi123 avatar kevingpqi123 commented on June 6, 2024

你确认下是否调用了 setRepeatCount 接口,如果没有调用,默认是只播放一次,进入后台后,定时器并没有停止,只是停止了渲染,如果播放次数没有设置或者设置次数较少是会出现你所说的情况,这是正常的
要解决这个问题,增加调用 setRepeatCount(0)即可

from libpag.

petyou avatar petyou commented on June 6, 2024

@kevingpqi123 上述录屏来自于官方提供的最新demo(未作任何修改),看了demo中的代码已经设置了 setRepeatCount(0)。
`- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
if ([self.pagView isPlaying]) {
[self.pagView stop];
} else {
[self.pagView play];
}

}

/**
初始化PAGView
*/

  • (void)initPAGView {
    //读取PAG素材文件
    NSString* resourcePath = [self resourcePath];
    self.pagFile = [PAGFile Load:resourcePath];

    //创建PAG播放视图PAGView
    self.pagView = [[PAGView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:self.pagView];

    //关联PAGView和PAGFile
    [self.pagView setComposition:self.pagFile];
    //3.0中pagView中可以使用setPath直接使用file,setPath在pag中会根据path缓存pagFile,实现一次加载多个地方调用
    //[self.pagView setPath:resourcePath];
    //3.0中 [self.pagView setFile:self.pagFile]方法被废弃,如果使用setFile则无法通过file对替换数据进行控制;

    //设置循环播放,默认只播放一次
    [self.pagView setRepeatCount:0];

    //播放
    [self.pagView play];

    [self.view sendSubviewToBack:self.pagView];
    }

`

下载地址:https://pag.art/docs/pad-demo-download.html

from libpag.

Creolophus avatar Creolophus commented on June 6, 2024

一样碰到从后台回前台偶发暂停播放

from libpag.

petyou avatar petyou commented on June 6, 2024

@kevingpqi123 大佬解决下啊,这个描述得够清楚了,官方给的demo都能复现。按道理说是个严重问题啊。。

from libpag.

DongDian455 avatar DongDian455 commented on June 6, 2024

ios退到后台30秒,回到前台无法播放

from libpag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.