}\r
if ( isWait && (startTime >= this.begin) ) {\r
this.state = begin;\r
+ /*beginプロパティに開始時刻をキャッシュ用に保存*/\r
+ this.begin = startTime;\r
} else if (isWait) {\r
return this;\r
} else if (state === begin) {\r
this.state = play;\r
} else if (state === play) {\r
- if (endTime >= this.begin) {\r
+ if ( (endTime >= this.begin) && (startTime > this.begin) ) {\r
+ /*終了時刻に到達したか、再び開始イベントが発火されたとき*/\r
this.state = end;\r
} else {\r
return this;\r
}\r
} else if (state === end) {\r
- this.state = post;\r
+ if (startTime > this.begin) {\r
+ this.state = begin;\r
+ } else {\r
+ this.state = post;\r
+ }\r
} else {\r
this.state = begin;\r
}\r
};\r
appendBegin(0);\r
expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
- expect(frame.state).toBe(frame.BEGINNING);\r
+ expect(frame.begin).toBe(0);\r
expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
expect(frame.state).toBe(frame.PLAYING);\r
expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
frame.begin = 0;\r
frame.state = frame.WAITING;\r
expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
+ expect(frame.begin).toBe(0);\r
expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
+ expect(frame.begin).toBe(0);\r
expect(frame.updateState(1).state).toBe(frame.ENDING);\r
expect(frame.updateState(1).state).toBe(frame.BEGINNING);\r
+ expect(frame.begin).toBe(1);\r
expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
\r